Fix tokenflow and tests

This commit is contained in:
Luke Van Seters 2021-08-23 16:17:29 -04:00
parent 98af6aa5f9
commit 3587d0bd42
7 changed files with 11 additions and 46321 deletions

View File

@ -12,6 +12,7 @@ class Receipt(CamelModel):
gas_used: int
effective_gas_price: int
cumulative_gas_used: int
to: str
@validator(
"block_number",

View File

@ -62,9 +62,9 @@ def is_known_router_address(address):
# we're interested in the to address to run token flow on it as well
def get_tx_to_address(tx_hash, block) -> Optional[str]:
for receipt in block.receipts["result"]:
if receipt["transactionHash"] == tx_hash:
return receipt["to"]
for receipt in block.receipts:
if receipt.transaction_hash == tx_hash:
return receipt.to
return None

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,14 +7,15 @@ from .utils import load_test_block
def test_arbitrage_real_block():
block = load_test_block(12914994)
block = load_test_block(12914944)
trace_clasifier = TraceClassifier(ALL_CLASSIFIER_SPECS)
classified_traces = trace_clasifier.classify(block.traces)
swaps = get_swaps(classified_traces)
arbitrages = get_arbitrages(swaps)
assert len(swaps) == 51
arbitrages = get_arbitrages(list(swaps))
assert len(arbitrages) == 1
arbitrage = arbitrages[0]