Esempio n. 1
0
def client(
        sender_privkey: str,
        channel_manager_address: str,
        web3: Web3,
        clean_channels: bool,
        private_keys: List[str],
        patched_contract,
        revert_chain
):
    client = Client(
        private_key=sender_privkey,
        channel_manager_address=channel_manager_address,
        web3=web3
    )
    if clean_channels:
        close_all_channels_cooperatively(
            client,
            private_keys,
            channel_manager_address,
        )

    yield client

    if clean_channels:
        close_all_channels_cooperatively(
            client,
            private_keys,
            channel_manager_address,
        )
Esempio n. 2
0
def clean_channels(client: Client, receiver_privkey: str,
                   channel_manager_contract_address: str):
    close_all_channels_cooperatively(client,
                                     receiver_privkey,
                                     channel_manager_contract_address,
                                     balance=0)
    yield
    close_all_channels_cooperatively(client,
                                     receiver_privkey,
                                     channel_manager_contract_address,
                                     balance=0)
Esempio n. 3
0
def client(sender_privkey: str, client_contract_proxy: ChannelContractProxy,
           client_token_proxy: ContractProxy, clean_channels: bool,
           receiver_privkey: str, revert_chain):
    client = Client(privkey=sender_privkey,
                    channel_manager_proxy=client_contract_proxy,
                    token_proxy=client_token_proxy)
    if clean_channels:
        close_all_channels_cooperatively(client, receiver_privkey, balance=0)

    yield client

    if clean_channels:
        close_all_channels_cooperatively(client, receiver_privkey, balance=0)
Esempio n. 4
0
def client(sender_privkey: str, channel_manager_address: str, web3: Web3,
           clean_channels: bool, receiver_privkey: str, patched_contract,
           revert_chain):
    client = Client(private_key=sender_privkey,
                    channel_manager_address=channel_manager_address,
                    web3=web3)
    if clean_channels:
        close_all_channels_cooperatively(client, receiver_privkey, balance=0)

    yield client

    if clean_channels:
        close_all_channels_cooperatively(client, receiver_privkey, balance=0)
Esempio n. 5
0
def clean_channels(client):
    close_all_channels_cooperatively(client, balance=0)
    yield
    close_all_channels_cooperatively(client, balance=0)