def test_channel_open_with_deposit_events(
    get_accounts: Callable,
    token_network: Contract,
    event_handler: Callable,
    assign_tokens: Callable,
) -> None:
    """A successful openChannelWithDeposit() causes an OPENED and DEPOSIT event"""
    ev_handler = event_handler(token_network)
    (A, B) = get_accounts(2)
    deposit = 100

    assign_tokens(A, deposit)
    txn_hash = call_and_transact(
        token_network.functions.openChannelWithDeposit(
            A, B, TEST_SETTLE_TIMEOUT_MIN, deposit),
        {"from": A},
    )
    channel_identifier = token_network.functions.getChannelIdentifier(
        A, B).call()

    ev_handler.add(
        txn_hash,
        ChannelEvent.OPENED,
        check_channel_opened(channel_identifier, A, B,
                             TEST_SETTLE_TIMEOUT_MIN),
    )
    ev_handler.add(
        txn_hash,
        ChannelEvent.DEPOSIT,
        check_new_deposit(channel_identifier, A, deposit),
    )
    ev_handler.check()
Exemplo n.º 2
0
def test_open_channel_event(get_accounts, token_network, event_handler):
    ev_handler = event_handler(token_network)
    (A, B) = get_accounts(2)

    txn_hash = token_network.transact().openChannel(A, B, SETTLE_TIMEOUT_MIN)
    channel_identifier = token_network.call().getChannelIdentifier(A, B)

    ev_handler.add(
        txn_hash,
        E_CHANNEL_OPENED,
        check_channel_opened(channel_identifier, A, B, SETTLE_TIMEOUT_MIN)
    )
    ev_handler.check()
def test_open_channel_event(get_accounts, token_network, event_handler):
    ev_handler = event_handler(token_network)
    (A, B) = get_accounts(2)

    txn_hash = token_network.functions.openChannel(A, B, TEST_SETTLE_TIMEOUT_MIN).transact()
    channel_identifier = token_network.functions.getChannelIdentifier(A, B).call()

    ev_handler.add(
        txn_hash,
        ChannelEvent.OPENED,
        check_channel_opened(channel_identifier, A, B, TEST_SETTLE_TIMEOUT_MIN),
    )
    ev_handler.check()
def test_open_channel_event(get_accounts: Callable, token_network: Contract,
                            event_handler: Callable) -> None:
    """A successful openChannel() causes an OPENED event"""
    ev_handler = event_handler(token_network)
    (A, B) = get_accounts(2)

    txn_hash = call_and_transact(
        token_network.functions.openChannel(A, B, TEST_SETTLE_TIMEOUT_MIN))
    channel_identifier = token_network.functions.getChannelIdentifier(
        A, B).call()

    ev_handler.add(
        txn_hash,
        ChannelEvent.OPENED,
        check_channel_opened(channel_identifier, A, B,
                             TEST_SETTLE_TIMEOUT_MIN),
    )
    ev_handler.check()