Пример #1
0
def set_closed(
    channel_state: NettingChannelState,
    block_number: typing.BlockNumber,
) -> None:
    if not channel_state.close_transaction:
        channel_state.close_transaction = TransactionExecutionStatus(
            None,
            block_number,
            TransactionExecutionStatus.SUCCESS,
        )

    elif not channel_state.close_transaction.finished_block_number:
        channel_state.close_transaction.finished_block_number = block_number
        channel_state.close_transaction.result = TransactionExecutionStatus.SUCCESS
Пример #2
0
def events_for_close(
    channel_state: NettingChannelState,
    block_number: typing.BlockNumber,
) -> typing.List[Event]:
    events = list()

    if get_status(channel_state) in CHANNEL_STATES_PRIOR_TO_CLOSED:
        channel_state.close_transaction = TransactionExecutionStatus(
            block_number, None, None)

        close_event = ContractSendChannelClose(
            channel_state.identifier,
            channel_state.token_address,
            channel_state.partner_state.balance_proof,
        )

        events.append(close_event)

    return events