|
InstanceDescription | from_json_dict (Dict[str, Any] desc_json) |
|
InstanceDescription | deploy (Any web3, str source_file, str contract_name, str deployer_eth_address, Optional[bytes] deployer_eth_private_key, Optional[int] deployment_gas, Dict[str, Any] compiler_flags=None, Iterable[Any] args=None) |
|
InstanceDescription | deploy_from_compiled (Any web3, str deployer_eth_address, Optional[bytes] deployer_eth_private_key, Optional[int] deployment_gas, Any compiled, *Any args) |
|
Any | compile (str source_file, str contract_name, Dict[str, Any] compiler_flags=None) |
|
Minimal data required to instantiate the in-memory interface to a contract.
Definition at line 21 of file contracts.py.
◆ __init__()
def zeth.core.contracts.InstanceDescription.__init__ |
( |
|
self, |
|
|
str |
address, |
|
|
Dict[str, Any] |
abi |
|
) |
| |
Definition at line 25 of file contracts.py.
25 def __init__(self, address: str, abi: Dict[str, Any]):
26 self.address = address
◆ compile()
Any zeth.core.contracts.InstanceDescription.compile |
( |
str |
source_file, |
|
|
str |
contract_name, |
|
|
Dict[str, Any] |
compiler_flags = None |
|
) |
| |
|
static |
Definition at line 96 of file contracts.py.
99 compiler_flags: Dict[str, Any] =
None) \
101 compiled_all =
compile_files([source_file], **(compiler_flags
or {}))
103 compiled = compiled_all[f
"{source_file}:{contract_name}"]
◆ deploy()
InstanceDescription zeth.core.contracts.InstanceDescription.deploy |
( |
Any |
web3, |
|
|
str |
source_file, |
|
|
str |
contract_name, |
|
|
str |
deployer_eth_address, |
|
|
Optional[bytes] |
deployer_eth_private_key, |
|
|
Optional[int] |
deployment_gas, |
|
|
Dict[str, Any] |
compiler_flags = None , |
|
|
Iterable[Any] |
args = None |
|
) |
| |
|
static |
Compile and deploy a contract, returning the live instance and an instance
description (which the caller should save in order to access the
instance in the future).
Definition at line 40 of file contracts.py.
44 deployer_eth_address: str,
45 deployer_eth_private_key: Optional[bytes],
46 deployment_gas: Optional[int],
47 compiler_flags: Dict[str, Any] =
None,
48 args: Iterable[Any] =
None) -> InstanceDescription:
50 Compile and deploy a contract, returning the live instance and an instance
51 description (which the caller should save in order to access the
52 instance in the future).
54 compiled = InstanceDescription.compile(
55 source_file, contract_name, compiler_flags)
57 instance_desc = InstanceDescription.deploy_from_compiled(
60 deployer_eth_private_key,
65 f
"deploy: contract: {contract_name} "
66 f
"to address: {instance_desc.address}")
◆ deploy_from_compiled()
InstanceDescription zeth.core.contracts.InstanceDescription.deploy_from_compiled |
( |
Any |
web3, |
|
|
str |
deployer_eth_address, |
|
|
Optional[bytes] |
deployer_eth_private_key, |
|
|
Optional[int] |
deployment_gas, |
|
|
Any |
compiled, |
|
|
*Any |
args |
|
) |
| |
|
static |
Definition at line 70 of file contracts.py.
70 def deploy_from_compiled(
72 deployer_eth_address: str,
73 deployer_eth_private_key: Optional[bytes],
74 deployment_gas: Optional[int],
76 *args: Any) -> InstanceDescription:
77 contract = web3.eth.contract(
78 abi=compiled[
'abi'], bytecode=compiled[
'bin'])
79 construct_call = contract.constructor(*args)
84 deployer_eth_private_key,
88 tx_receipt = web3.eth.waitForTransactionReceipt(tx_hash, 10000)
89 contract_address = tx_receipt[
'contractAddress']
91 f
"deploy: tx_hash={tx_hash[0:8].hex()}, " +
92 f
" gasUsed={tx_receipt.gasUsed}, status={tx_receipt.status}")
93 return InstanceDescription(contract_address, compiled[
'abi'])
◆ from_json_dict()
InstanceDescription zeth.core.contracts.InstanceDescription.from_json_dict |
( |
Dict[str, Any] |
desc_json | ) |
|
|
static |
Definition at line 36 of file contracts.py.
36 def from_json_dict(desc_json: Dict[str, Any]) -> InstanceDescription:
37 return InstanceDescription(desc_json[
"address"], desc_json[
"abi"])
◆ instantiate()
Any zeth.core.contracts.InstanceDescription.instantiate |
( |
|
self, |
|
|
Any |
web3 |
|
) |
| |
Return the instantiated contract
Definition at line 107 of file contracts.py.
107 def instantiate(self, web3: Any) -> Any:
109 Return the instantiated contract
111 return web3.eth.contract(address=self.address, abi=self.abi)
◆ to_json_dict()
Dict[str, Any] zeth.core.contracts.InstanceDescription.to_json_dict |
( |
|
self | ) |
|
Definition at line 29 of file contracts.py.
29 def to_json_dict(self) -> Dict[str, Any]:
31 "address": self.address,
◆ abi
zeth.core.contracts.InstanceDescription.abi |
◆ address
zeth.core.contracts.InstanceDescription.address |
The documentation for this class was generated from the following file:
None deploy(Context ctx, Optional[str] eth_addr, Optional[str] eth_private_key, str instance_out, Optional[str] token_address, Optional[str] permitted_dispatcher, Optional[str] vk_hash, Optional[int] deploy_gas)
bytes send_contract_call(Any web3, Any call, str sender_eth_addr, Optional[bytes] sender_eth_private_key=None, Optional[EtherValue] value=None, Optional[int] gas=None)