Skip to content

Parse Pair created events real-time for uniswapv2 #278

Open
@rragundez

Description

@rragundez

In the examples for uniswapv2 real time, there is no function to decode pair created events. It just logs the event:

if log_result["event"].event_name == "PairCreated":
    logger.info(f"New pair created: {log_result}")
elif log_result["event"].event_name == "Swap":
    swap = decode_swap(web3, log_result)
    swap_fmt = format_swap(swap)
    logger.info("%s", swap_fmt)
else:
    raise NotImplementedError()

coming from https://web3-ethereum-defi.readthedocs.io/tutorials/live-swap.html

So I used the decode_pair_creatred function in the historical script exmple https://web3-ethereum-defi.readthedocs.io/tutorials/event-reader.html# but the job keeps crashing for different reasons when using that function in the live scenario.
Do you have an example or an extension of the live example with a working decode_pair_created function?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions