Conversation
|
|
||
| assert all(h == tx_hash for h, _ in transaction_tokens) | ||
| assert set(token_address for _, token_address in transaction_tokens) == { | ||
| "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9", |
There was a problem hiding this comment.
Note that USDT is removed from the list (it used to be there), as it never touches the settlement contract, so there is definitely no need to include it here.
Maybe we can rename the function itself if you think it is now misleading, but basically it now computes the tokens that are transferred in or out of the settlement contract
There was a problem hiding this comment.
The new behavior should be fine.
fhenneke
left a comment
There was a problem hiding this comment.
Generally looks good. But there are too many changes to check this in detail.
It is a good idea, though, to separate the structural changes from behavioral changes. (Still a bit mixed here, but not much.)
| @@ -121,21 +121,28 @@ def extract_actions(self, traces: list[AttributeDict], address: str) -> list[dic | |||
| actions.append(dict(action)) | |||
| return actions | |||
|
|
|||
| def calculate_native_eth_imbalance(self, actions: list[dict], address: str) -> int: | |||
There was a problem hiding this comment.
This change looks like a regression in terms of complexity and code style.
What was the rational?
If the change of return type is required, make only that change here, e.g. via if in_flow == 0 and out_flow == 0: return None.
The docstring should mention what it means if None is returned.
|
|
||
| assert all(h == tx_hash for h, _ in transaction_tokens) | ||
| assert set(token_address for _, token_address in transaction_tokens) == { | ||
| "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9", |
There was a problem hiding this comment.
The new behavior should be fine.
| process_imbalances = os.getenv("PROCESS_IMBALANCES", "True") == "True" | ||
| process_prices = os.getenv("PROCESS_PRICES", "False") == "True" | ||
| process_fees = os.getenv("PROCESS_FEES", "False") == "True" | ||
|
|
There was a problem hiding this comment.
Using config variables here sounds good.
It should be done at some point. If it is easy now, include it. If it is not easy, we can do it separately. |
This PR attempts to push some functionality out of the
TransactionProcessorobject and inside the helper classes that are built around it, and specifically thecompute_token_imbalancesfunction is now pushed to theRawTokenImbalancesclass.This is still in draft mode as more changes might be pushed.