Skip to content

Listener: Define the interfaces for all the functions in Listener #4

Closed
@deepesh-kn

Description

@deepesh-kn

The scanner listener reads each and every block from the chain and looks for StakeRequested event for the given composer contract. Once the event is found it callbacks the facilitator with event data.
scanner listener keeps a record of the last block scanned so that it can resume the scanner listener from the same block height. For more details check the epic #1

The scanner listener can be for the origin and auxiliary chain.
The scanner listener should update the database tables.

This ticket is about defining the interfaces of all the functions in the scanner listener.

The proposed functions are provided for reference.
The implementer can think this in detail and can add/remove functions

We can call this as EventListner.

  • constructor.
    - Accepts mosaic-config and facilitator-config.

    • Accepts Config object. (store in variable).
    • Accepts object that cointains {contractAddresss: [Event topics]}.
    • Creates DB object. (store in variable). (Still in discussion)
  • function to scan the blocks in batches. (Start scan)

    • Accepts blockNumber as a parameter.
    • blockNumber is an optional param, if this is provided then the scanner listener will start scanning from that block, else it will start from the latest block.
    • Keep track of last block number that was scanned.

- [ ] function to update the last scanned block number.
- [ ] function to get transactions for the given block.
- [ ] function to get events from the given transaction.
- [ ] function to emit an event when StakeRequested event is found.

  • function to stop the scanner listener (SIGTERM). (Update the ticket)

- [ ] function to updates stake_request table status. (create a new ticket for this.)

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