JSONFileScanState

Documentation for eth_defi.event_reader.json_state.JSONFileScanState Python class.

class JSONFileScanState

Bases: eth_defi.event_reader.state.ScanState

Save and resume block event scan using state serialised in JSON file.

Parameters

fname – In which file we store the last processed block number.

Methods summary

__init__(fname)

param fname

In which file we store the last processed block number.

restore_state(default_block)

Restore the last block we have processes.

save_state(last_block)

Saves the last block we have read.

__init__(fname)
Parameters

fname (str) – In which file we store the last processed block number.

save_state(last_block)

Saves the last block we have read.

restore_state(default_block)

Restore the last block we have processes.

Returns

Tuple (did we restore state, the first block numebr to scan)

Parameters

default_block (int) –

Return type

Tuple[bool, int]