added liquidations code based on event logs

This commit is contained in:
nikhilsamrat 2022-07-05 14:30:01 +05:30
parent 825a10be51
commit e9aa7b1d6b
4 changed files with 42 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@ -88,7 +88,7 @@ async def inspect_many_blocks(
count = 0
arbitrages_payload = []
async for swaps in get_classified_traces_from_events(w3, after_block_number, before_block_number):
async for swaps, liquidations in get_classified_traces_from_events(w3, after_block_number, before_block_number):
arbitrages = get_arbitrages(swaps)
@ -112,6 +112,9 @@ async def inspect_many_blocks(
arbitrages_payload = []
count = 0
if len(liquidations) > 0:
print(liquidations)
# all_blocks: List[Block] = []
# all_classified_traces: List[ClassifiedTrace] = []
# all_transfers: List[Transfer] = []

View File

@ -67,7 +67,7 @@ class MEVInspector:
trace_db_session: Optional[orm.Session],
after_block: int,
before_block: int,
block_batch_size: int = 10,
block_batch_size: int = 300,
):
tasks = []
for block_number in range(after_block, before_block, block_batch_size):

View File

@ -12,7 +12,7 @@ class Liquidation(BaseModel):
debt_purchase_amount: int
received_amount: int
received_token_address: Optional[str]
protocol: Protocol
protocol: Optional[Protocol]
transaction_hash: str
trace_address: List[int]
block_number: str