Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
Functions | Variables
zeth.helper.token_approve Namespace Reference

Functions

None token_approve (Context ctx, str value, str eth_addr, str eth_private_key, bool wait, str instance_file)
 

Variables

 help
 
 is_flag
 
 True
 
 default
 

Function Documentation

◆ token_approve()

None zeth.helper.token_approve.token_approve ( Context  ctx,
str  value,
str  eth_addr,
str  eth_private_key,
bool  wait,
str  instance_file 
)
Approve the mixer to spend some amount of ERC20/223 tokens

Definition at line 22 of file token_approve.py.

22 def token_approve(
23  ctx: Context,
24  value: str,
25  eth_addr: str,
26  eth_private_key: str,
27  wait: bool,
28  instance_file: str) -> None:
29  """
30  Approve the mixer to spend some amount of ERC20/223 tokens
31  """
32  approve_value = EtherValue(value)
33  eth_addr = load_eth_address(eth_addr)
34  eth_private_key_data = load_eth_private_key(eth_private_key)
35  web3 = open_web3_from_network(get_eth_network(ctx.obj["eth_network"]))
36  mixer_desc = load_mixer_description(instance_file)
37  if not mixer_desc.token:
38  raise ClickException("no token for mixer {mixer_desc.mixer.address}")
39 
40  token_instance = mixer_desc.token.instantiate(web3)
41  approve_call = token_instance.functions.approve(
42  mixer_desc.mixer.address,
43  approve_value.wei)
44  tx_hash = send_contract_call(
45  web3, approve_call, eth_addr, eth_private_key_data)
46 
47  if wait:
48  web3.eth.waitForTransactionReceipt(tx_hash) # pylint: disable=no-member
49  else:
50  print(tx_hash.hex())
Here is the call graph for this function:

Variable Documentation

◆ default

zeth.helper.token_approve.default

Definition at line 19 of file token_approve.py.

◆ help

zeth.helper.token_approve.help

Definition at line 14 of file token_approve.py.

◆ is_flag

zeth.helper.token_approve.is_flag

Definition at line 16 of file token_approve.py.

◆ True

zeth.helper.token_approve.True

Definition at line 16 of file token_approve.py.

zeth.cli.utils.get_eth_network
NetworkConfig get_eth_network(Optional[str] eth_network)
Definition: utils.py:84
zeth.cli.utils.load_eth_address
str load_eth_address(Optional[str] eth_addr)
Definition: utils.py:444
zeth.helper.token_approve.token_approve
None token_approve(Context ctx, str value, str eth_addr, str eth_private_key, bool wait, str instance_file)
Definition: token_approve.py:22
zeth.cli.utils.load_eth_private_key
Optional[bytes] load_eth_private_key(Optional[str] private_key_file)
Definition: utils.py:465
zeth.cli.utils.load_mixer_description
MixerDescription load_mixer_description(str mixer_desc_file)
Definition: utils.py:212
zeth.cli.utils.open_web3_from_network
Any open_web3_from_network(NetworkConfig eth_net)
Definition: utils.py:114
zeth.core.contracts.send_contract_call
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)
Definition: contracts.py:131