-
Notifications
You must be signed in to change notification settings - Fork 266
Add JIT Liquidity Classifier #292
base: main
Are you sure you want to change the base?
Conversation
… recursive spagetti
@elicbarbieri a couple interesting fields to add to the schema alongside tx details:
|
@mikemcdonald calculating these metrics would require a minimum of 2 calls to the RPC, and probably decoding the logs from the liquidity burn and mint. All the data from mev-inspect is derived from the transaction traces, and there is no accurate way to get the fees and liquidity across ticks from the traces. The rest of the codebase minimizes calls to the RPC and it doesn't make sense to change that now. I will probably pull the raw JIT data into a CSV and calculate these metrics later, and will make sure to post that. |
mev_inspect/transfers.py
Outdated
trace.from_address, | ||
] | ||
|
||
else: # trace.function_signature == "transferFrom(address,address,uint256)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the else case is implying a new case that we're aware of, use elif
, and change the else case for the scenario where the function signature is an unexpected transfer function. Make assumptions explicit in the code (not in the comments)
mev_inspect/transfers.py
Outdated
classified_traces: List[ClassifiedTrace], | ||
) -> List[Transfer]: | ||
""" | ||
Super Jank... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean up this docstring
mev_inspect/transfers.py
Outdated
if sorted(net_search_info) in found_transfers: | ||
for index, transfer in enumerate(return_transfers): | ||
if ( | ||
transfer.token_address != net_search_info[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's unclear what comparisons are being made against net_search_info due to the list, i would use a dictionary with appropriate key names, that way these are legible
mev_inspect/jit_liquidity.py
Outdated
None, | ||
) | ||
|
||
# This would be cleaner with bisect(), but creates 3.10 dependency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, can remove now
mev_inspect/jit_liquidity.py
Outdated
return "0x0000000000000000000000000000000000000000" | ||
|
||
# This case is here because from_address is optional in ClassifiedTrace | ||
if type(mint_trace.from_address) == str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an attribute (from_address) is Optional in the schema, the object can be created without passing a value and the key will not exist in the dictionary. This will then throw a KeyError. I believe a better check would be
if 'from_address' in mint_trace.keys()
… I created join table migration before main table
…to handle uni-v3 single token liquidity
…dling for mint and burn amounts
… recursive spagetti
… I created join table migration before main table
…to handle uni-v3 single token liquidity
…dling for mint and burn amounts
…mev-inspect-py into add-jit-classifier
Adding Just in time liquidity classification
Tests are based on block 13601096
Added necessary classification, schemas and models