예제 #1
0
def get_netting_channel_closed_events(
    chain: BlockChainService,
    token_network_address: Address,
    netting_channel_identifier: ChannelID,
    contract_manager: ContractManager,
    from_block: BlockSpecification = 0,
    to_block: BlockSpecification = 'latest',
) -> List[Dict]:
    closed_event_abi = contract_manager.get_event_abi(
        CONTRACT_TOKEN_NETWORK,
        ChannelEvent.CLOSED,
    )

    topic_set = construct_event_topic_set(
        event_abi=closed_event_abi,
        arguments={'channel_identifier': netting_channel_identifier},
    )

    if len(topic_set) == 1 and is_list_like(topic_set[0]):
        topics = topic_set[0]
    else:
        topics = topic_set

    return get_contract_events(
        chain=chain,
        abi=contract_manager.get_contract_abi(CONTRACT_TOKEN_NETWORK),
        contract_address=token_network_address,
        topics=topics,
        from_block=from_block,
        to_block=to_block,
    )
예제 #2
0
def get_netting_channel_deposit_events(
        chain: BlockChainService,
        token_network_address: Address,
        netting_channel_identifier: ChannelID,
        contract_manager: ContractManager,
        from_block: BlockSpecification = GENESIS_BLOCK_NUMBER,
        to_block: BlockSpecification = 'latest',
) -> List[Dict]:
    deposit_event_abi = contract_manager.get_event_abi(
        CONTRACT_TOKEN_NETWORK,
        ChannelEvent.DEPOSIT,
    )
    topic_set = construct_event_topic_set(
        event_abi=deposit_event_abi,
        arguments={'channel_identifier': netting_channel_identifier},
    )

    if len(topic_set) == 1 and is_list_like(topic_set[0]):
        topics = topic_set[0]
    else:
        topics = topic_set

    return get_contract_events(
        chain,
        contract_manager.get_contract_abi(CONTRACT_TOKEN_NETWORK),
        token_network_address,
        topics,
        from_block,
        to_block,
    )
예제 #3
0
def get_netting_channel_deposit_events(
        chain: BlockChainService,
        token_network_address: Address,
        netting_channel_identifier: ChannelID,
        contract_manager: ContractManager,
        from_block: BlockSpecification = GENESIS_BLOCK_NUMBER,
        to_block: BlockSpecification = 'latest',
) -> List[Dict]:
    deposit_event_abi = contract_manager.get_event_abi(
        CONTRACT_TOKEN_NETWORK,
        ChannelEvent.DEPOSIT,
    )
    topic_set = construct_event_topic_set(
        event_abi=deposit_event_abi,
        arguments={'channel_identifier': netting_channel_identifier},
    )

    if len(topic_set) == 1 and is_list_like(topic_set[0]):
        topics = topic_set[0]
    else:
        topics = topic_set

    return get_contract_events(
        chain,
        contract_manager.get_contract_abi(CONTRACT_TOKEN_NETWORK),
        token_network_address,
        topics,
        from_block,
        to_block,
    )
예제 #4
0
def get_netting_channel_settled_events(
        chain: BlockChainService,
        token_network_address: Address,
        netting_channel_identifier: ChannelID,
        from_block: BlockSpecification = 0,
        to_block: BlockSpecification = 'latest',
) -> List[Dict]:
    settled_event_abi = CONTRACT_MANAGER.get_event_abi(
        CONTRACT_TOKEN_NETWORK,
        ChannelEvent.SETTLED,
    )
    topic_set = construct_event_topic_set(
        event_abi=settled_event_abi,
        arguments={'channel_identifier': netting_channel_identifier},
    )

    if len(topic_set) == 1 and is_list_like(topic_set[0]):
        topics = topic_set[0]
    else:
        topics = topic_set

    return get_contract_events(
        chain,
        CONTRACT_MANAGER.get_contract_abi(CONTRACT_TOKEN_NETWORK),
        token_network_address,
        topics,
        from_block,
        to_block,
    )
def get_netting_channel_deposit_events(
    proxy_manager: ProxyManager,
    token_network_address: TokenNetworkAddress,
    netting_channel_identifier: ChannelID,
    contract_manager: ContractManager,
    from_block: BlockSpecification = GENESIS_BLOCK_NUMBER,
    to_block: BlockSpecification = "latest",
) -> List[Dict]:
    deposit_event_abi = contract_manager.get_event_abi(CONTRACT_TOKEN_NETWORK,
                                                       ChannelEvent.DEPOSIT)
    topic_set = construct_event_topic_set(
        event_abi=deposit_event_abi,
        arguments={"channel_identifier": netting_channel_identifier})

    if len(topic_set) == 1 and is_list_like(topic_set[0]):
        topics = topic_set[0]
    else:
        topics = topic_set

    return get_contract_events(
        proxy_manager,
        contract_manager.get_contract_abi(CONTRACT_TOKEN_NETWORK),
        Address(token_network_address),
        topics,
        from_block,
        to_block,
    )
예제 #6
0
파일: util.py 프로젝트: ezdac/ethevents
 def abi_to_topic0_dict(abi):
     """Map ABI event entries by their `topic0` hex key"""
     result = dict()
     for event_abi in EventABI.only_events(abi):
         result[events.construct_event_topic_set(event_abi)[0]
                [0]] = event_abi
     return result
def test_construct_event_topics(event_abi, arguments, expected):
    actual = construct_event_topic_set(event_abi, arguments)
    assert actual == expected
예제 #8
0
def test_construct_event_topics(event_abi, arguments, expected):
    actual = construct_event_topic_set(event_abi, arguments)
    assert actual == expected
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.proxy_factory_contract = get_proxy_factory_contract(
         self.ethereum_client.w3)
     self.proxy_creation_topic = construct_event_topic_set(
         self.proxy_factory_contract.events.ProxyCreation().abi, None)[0]