From 9c693807ea98533fea3e1926986f9e27a5345d19 Mon Sep 17 00:00:00 2001 From: Andrew Chiw Date: Tue, 2 Mar 2021 02:45:13 +0100 Subject: [PATCH 1/4] Action: corrected typing hint, __repr__() to quickly see what an Action is all about --- data/action.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data/action.py b/data/action.py index fc4f81d..0aa222a 100644 --- a/data/action.py +++ b/data/action.py @@ -2,7 +2,7 @@ from datetime import datetime class Action: - def __init__(self, timestamp: datetime, tx_hash: str, block_number: str, swap_fee: str, denorms: typing.Dict, action_type: str, action: typing.Dict): + def __init__(self, timestamp: datetime, tx_hash: str, block_number: str, swap_fee: str, denorms: typing.Dict, action_type: str, action: typing.List): self.timestamp = timestamp self.tx_hash = tx_hash self.block_number = block_number @@ -10,3 +10,6 @@ def __init__(self, timestamp: datetime, tx_hash: str, block_number: str, swap_fe self.denorms = denorms self.action_type = action_type self.action = action + + def __repr__(self): + return f'Action: {self.tx_hash} {len(self.action)} {self.action_type}' From f76d8f6810ed66c82b47bf79d1dcbf9691f00a5d Mon Sep 17 00:00:00 2001 From: Andrew Chiw Date: Tue, 2 Mar 2021 02:45:54 +0100 Subject: [PATCH 2/4] turn_events_into_actions: added detection of 1inch aggregate swaps (but it still doesn't show up in the final JSON for some reason) --- data/pulldata.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/data/pulldata.py b/data/pulldata.py index f5f93fd..347319c 100644 --- a/data/pulldata.py +++ b/data/pulldata.py @@ -184,7 +184,6 @@ def turn_events_into_actions(events_list, fees: typing.Dict, denorms: pd.DataFra # Get basic info from first event log, no matter how many there actually are first_event_log = events.iloc[0] ts = first_event_log["block_timestamp"] - tx_hash = first_event_log["transaction_hash"] block_number = first_event_log.name # Invariant data that exists parallel to these actions. Merge them @@ -193,9 +192,15 @@ def turn_events_into_actions(events_list, fees: typing.Dict, denorms: pd.DataFra denorm = format_denorms(denorms.loc[block_number].to_dict(orient="records")) # convert block_number and swap_fee to string to painlessly # convert to JSON later (numpy.int64 can't be JSON serialized) - a = Action(timestamp=ts.to_pydatetime(), tx_hash=tx_hash, block_number=str(block_number), swap_fee=str(fee), - denorms=denorm, action_type=first_event_log["type"], action=events.to_dict(orient="records")) - actions.append(a) + if first_event_log["type"] == "swap" and len(events) > 1: + print(txhash, "might be an aggregate swap") + for _, e in events.iterrows(): + actions.append(Action(timestamp=ts.to_pydatetime(), tx_hash=txhash, block_number=str(block_number), swap_fee=str(fee), + denorms=denorm, action_type=first_event_log["type"], action=[e.to_dict()])) + else: + a = Action(timestamp=ts.to_pydatetime(), tx_hash=txhash, block_number=str(block_number), swap_fee=str(fee), + denorms=denorm, action_type=first_event_log["type"], action=events.to_dict(orient="records")) + actions.append(a) return actions From 1a6f71d875e8076de1c495d8f67e4e7c003c1515 Mon Sep 17 00:00:00 2001 From: Andrew Chiw Date: Tue, 2 Mar 2021 02:46:27 +0100 Subject: [PATCH 3/4] produce_actions(): renamed actions to fit new understanding --- data/pulldata.py | 58 ++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/data/pulldata.py b/data/pulldata.py index 347319c..c057f40 100644 --- a/data/pulldata.py +++ b/data/pulldata.py @@ -310,13 +310,13 @@ def stage3_merge_actions(pool_address, grouped_actions): return actions_final def produce_actions(): - new_results, join_results, swap_results, exit_results, transfer_results, fees_results, denorms_results = stage1_load_sql_data(args.pool_address) + new_events, join_events, swap_events, exit_events, transfer_events, fees_results, denorms_results = stage1_load_sql_data(args.pool_address) - new_results["type"] = "new" - join_results["type"] = "join" - swap_results["type"] = "swap" - exit_results["type"] = "exit" - transfer_results["type"] = "transfer" + new_events["type"] = "new" + join_events["type"] = "join" + swap_events["type"] = "swap" + exit_events["type"] = "exit" + transfer_events["type"] = "transfer" # Later we will drop the column "address" from denorms, because it is # just the pool address - it never changes. @@ -328,28 +328,34 @@ def produce_actions(): # Pandas, please don't truncate columns when I print them out pd.set_option('display.max_colwidth', None) - initial_state = stage2_produce_initial_state(new_results, fees_results, transfer_results) + initial_state = stage2_produce_initial_state(new_events, fees_results, transfer_events) # save_pickle(initial_state, f"{args.pool_address}/initial_state.pickle") - actions = [] - actions.extend(turn_events_into_actions(new_results, fees_dict, denorms_results)) - actions.extend(turn_events_into_actions(join_results, fees_dict, denorms_results)) - actions.extend(turn_events_into_actions(swap_results, fees_dict, denorms_results)) - actions.extend(turn_events_into_actions(exit_results, fees_dict, denorms_results)) - actions.extend(turn_events_into_actions(transfer_results, fees_dict, denorms_results)) - - grouped_by_tx_actions = {} - for i, action in enumerate(actions): - tx_hash = actions[i].tx_hash - if grouped_by_tx_actions.get(tx_hash) is None: - grouped_by_tx_actions[tx_hash] = [] - grouped_by_tx_actions[tx_hash].append(action) - grouped_actions = list(map(lambda key: grouped_by_tx_actions[key], grouped_by_tx_actions)) - - # Filter out pool share transfer - grouped_actions = list(filter(lambda acts: not (len(acts) == 1 and acts[0].action_type == 'transfer'), grouped_actions)) - - actions = stage3_merge_actions(args.pool_address, grouped_actions) + events = [] + events.extend(turn_events_into_actions(new_events, fees_dict, denorms_results)) + events.extend(turn_events_into_actions(join_events, fees_dict, denorms_results)) + events.extend(turn_events_into_actions(swap_events, fees_dict, denorms_results)) + events.extend(turn_events_into_actions(exit_events, fees_dict, denorms_results)) + events.extend(turn_events_into_actions(transfer_events, fees_dict, denorms_results)) + + # save_pickle(events, f"{args.pool_address}/events.pickle") + # events = load_pickle(f"{args.pool_address}/events.pickle") + + events_grouped_by_txhash = {} + for i, action in enumerate(events): + tx_hash = events[i].tx_hash + if events_grouped_by_txhash.get(tx_hash) is None: + events_grouped_by_txhash[tx_hash] = [] + events_grouped_by_txhash[tx_hash].append(action) + save_pickle(events_grouped_by_txhash, f'{args.pool_address}/events_grouped_by_txhash.pickle') + events_grouped_by_txhash = load_pickle(f'{args.pool_address}/events_grouped_by_txhash.pickle') + + grouped_events = list(map(lambda key: events_grouped_by_txhash[key], events_grouped_by_txhash)) + + # Remove pool share transfers + grouped_events = list(filter(lambda acts: not (len(acts) == 1 and acts[0].action_type == 'transfer'), grouped_events)) + + actions = stage3_merge_actions(args.pool_address, grouped_events) # save_pickle(actions, f"{args.pool_address}/actions.pickle") # actions = load_pickle(f"{args.pool_address}/actions.pickle") From 4c9540e03b32a64f17e002cf69e43c1217cbf1b2 Mon Sep 17 00:00:00 2001 From: Andrew Chiw Date: Tue, 2 Mar 2021 03:50:48 +0100 Subject: [PATCH 4/4] produce_actions(): add turn_grouped_by_txhash_events_into_list_and_ungroup_1inch_aggregated_swaps() Current situation: turn_events_into_actions() detects 1inch aggregate swaps and makes them into separate Action objects. However, these separate Action objects are still grouped together later in produce_actions() by txhash. This messes up classify_actions(). So the function that turned the dict (that classified Action groups by txhash) needs to be made more complex. As new Defi startups figure out more ways to make trickier transactions, we might need to abandon the assumption of grouping by txhash. --- ...5f0492fe2bb3951a1787ef-actions-prices.json | 1328 +++++++++++------ data/pulldata.py | 18 +- 2 files changed, 894 insertions(+), 452 deletions(-) diff --git a/data/0xf9ab7776c7baeed1d65f0492fe2bb3951a1787ef-actions-prices.json b/data/0xf9ab7776c7baeed1d65f0492fe2bb3951a1787ef-actions-prices.json index 59bd933..76016b9 100644 --- a/data/0xf9ab7776c7baeed1d65f0492fe2bb3951a1787ef-actions-prices.json +++ b/data/0xf9ab7776c7baeed1d65f0492fe2bb3951a1787ef-actions-prices.json @@ -175170,26 +175170,74 @@ ], "action": { "type": "swap", - "tokens_in": [ - { - "amount": "833.404905183219191594", - "symbol": "BAL" - }, - { - "amount": "38.43306", - "symbol": "WETH" + "token_in": { + "amount": "833.404905183219191594", + "symbol": "BAL" + }, + "token_out": { + "amount": "18224566", + "symbol": "WBTC" + } + } + }, + { + "timestamp": "2020-08-15T03:19:33+00:00", + "tx_hash": "0xc97c17b65b347cf6439a8bbcd1309439c8a1a97fb863a80ce9d1c6ffa903a3b7", + "block_number": "10662168", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + }, + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WETH", + "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "tokenAmountIn": "38.43306", + "tokenOut_symbol": "BAL", + "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", + "minAmountOut": "0", + "maxPrice": "392318858461667547739736838950479151006.397215279002157056" } - ], - "tokens_out": [ - { - "amount": "18224566", - "symbol": "WBTC" - }, - { - "amount": "833.404905183219191594", - "symbol": "BAL" + }, + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "BAL", + "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3D", + "tokenAmountIn": "833.404905183219191594", + "tokenOut_symbol": "WBTC", + "tokenOut": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "minAmountOut": "0", + "maxPrice": "392318858461667547739736838950479151006.397215279002157056" } - ] + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "38.43306", + "symbol": "WETH" + }, + "token_out": { + "amount": "833.404905183219191594", + "symbol": "BAL" + } } }, { @@ -269780,26 +269828,74 @@ ], "action": { "type": "swap", - "tokens_in": [ - { - "amount": "236.198623107697414757", - "symbol": "BAL" - }, - { - "amount": "14.82558", - "symbol": "WETH" + "token_in": { + "amount": "236.198623107697414757", + "symbol": "BAL" + }, + "token_out": { + "amount": "6398826", + "symbol": "WBTC" + } + } + }, + { + "timestamp": "2020-08-24T10:02:47+00:00", + "tx_hash": "0xdf1931b11a02aa238fa7515551cce2d6f8a50bdd67052d5bee2e0e7b309d3ee2", + "block_number": "10722405", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + }, + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WETH", + "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "tokenAmountIn": "14.82558", + "tokenOut_symbol": "BAL", + "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", + "minAmountOut": "0", + "maxPrice": "392318858461667547739736838950479151006.397215279002157056" } - ], - "tokens_out": [ - { - "amount": "6398826", - "symbol": "WBTC" - }, - { - "amount": "236.198623107697414757", - "symbol": "BAL" + }, + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "BAL", + "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3D", + "tokenAmountIn": "236.198623107697414757", + "tokenOut_symbol": "WBTC", + "tokenOut": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "minAmountOut": "0", + "maxPrice": "392318858461667547739736838950479151006.397215279002157056" } - ] + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "14.82558", + "symbol": "WETH" + }, + "token_out": { + "amount": "236.198623107697414757", + "symbol": "BAL" + } } }, { @@ -510192,26 +510288,74 @@ ], "action": { "type": "swap", - "tokens_in": [ - { - "amount": "159.87096", - "symbol": "BAL" - }, - { - "amount": "204.27956", - "symbol": "BAL" + "token_in": { + "amount": "159.87096", + "symbol": "BAL" + }, + "token_out": { + "amount": "6.609950712704367923", + "symbol": "WETH" + } + } + }, + { + "timestamp": "2020-10-08T02:13:43+00:00", + "tx_hash": "0x9a6a5bfefe69f95be3adca4b0a2a104b1fc7b62129c6f8e6767a1f4238d474a9", + "block_number": "11012249", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + }, + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "BAL", + "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3D", + "tokenAmountIn": "159.87096", + "tokenOut_symbol": "WETH", + "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "minAmountOut": "1E-18", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } - ], - "tokens_out": [ - { - "amount": "6.609950712704367923", - "symbol": "WETH" - }, - { - "amount": "3382999", - "symbol": "WBTC" + }, + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "BAL", + "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3D", + "tokenAmountIn": "204.27956", + "tokenOut_symbol": "WBTC", + "tokenOut": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "minAmountOut": "0", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } - ] + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "204.27956", + "symbol": "BAL" + }, + "token_out": { + "amount": "3382999", + "symbol": "WBTC" + } } }, { @@ -510504,26 +510648,74 @@ ], "action": { "type": "swap", - "tokens_in": [ - { - "amount": "447.23532971026", - "symbol": "BAL" - }, - { - "amount": "157.26956649152", - "symbol": "BAL" + "token_in": { + "amount": "447.23532971026", + "symbol": "BAL" + }, + "token_out": { + "amount": "7279711", + "symbol": "WBTC" + } + } + }, + { + "timestamp": "2020-10-08T07:21:05+00:00", + "tx_hash": "0x4e708f4c4d5029e7e4e3f99c4d699a5fb9f52772fd5b6dc6d17d581a100181b8", + "block_number": "11013566", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + }, + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "BAL", + "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3D", + "tokenAmountIn": "157.26956649152", + "tokenOut_symbol": "WETH", + "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "minAmountOut": "1E-18", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } - ], - "tokens_out": [ - { - "amount": "7279711", - "symbol": "WBTC" - }, - { - "amount": "6.450635831831913964", - "symbol": "WETH" + }, + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "BAL", + "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3D", + "tokenAmountIn": "447.23532971026", + "tokenOut_symbol": "WBTC", + "tokenOut": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "minAmountOut": "0", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } - ] + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "157.26956649152", + "symbol": "BAL" + }, + "token_out": { + "amount": "6.450635831831913964", + "symbol": "WETH" + } } }, { @@ -639052,26 +639244,74 @@ ], "action": { "type": "swap", - "tokens_in": [ - { - "amount": "128.135721233600408223", - "symbol": "BAL" - }, - { - "amount": "1252208", - "symbol": "WBTC" + "token_in": { + "amount": "128.135721233600408223", + "symbol": "BAL" + }, + "token_out": { + "amount": "1252208", + "symbol": "WBTC" + } + } + }, + { + "timestamp": "2020-11-15T22:16:08+00:00", + "tx_hash": "0x752396cb7a17f321f1de66b0950bd8973d1fd0cccd780b0ece74a900dd13a4d3", + "block_number": "11265135", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + }, + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "BAL", + "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3D", + "tokenAmountIn": "128.135721233600408223", + "tokenOut_symbol": "WBTC", + "tokenOut": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "minAmountOut": "0", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } - ], - "tokens_out": [ - { - "amount": "1252208", - "symbol": "WBTC" - }, - { - "amount": "3.600264237390163231", - "symbol": "WETH" + }, + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WBTC", + "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "tokenAmountIn": "1252208", + "tokenOut_symbol": "WETH", + "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "minAmountOut": "0", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } - ] + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "1252208", + "symbol": "WBTC" + }, + "token_out": { + "amount": "3.600264237390163231", + "symbol": "WETH" + } } }, { @@ -697998,10 +698238,106 @@ "inputs": { "tokenIn_symbol": "WETH", "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "tokenAmountIn": "0.849900000000000128", + "tokenAmountIn": "0.849900000000000128", + "tokenOut_symbol": "BAL", + "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", + "minAmountOut": "0", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" + } + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "0.849900000000000128", + "symbol": "WETH" + }, + "token_out": { + "amount": "33.211004317532025209", + "symbol": "BAL" + } + } + }, + { + "timestamp": "2020-11-28T02:35:37+00:00", + "tx_hash": "0x92eefd6513c55db7528d45e4bed1aed01a062dc826f03c6b6606c45817eb51c8", + "block_number": "11344350", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + }, + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WETH", + "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "tokenAmountIn": "2.59", + "tokenOut_symbol": "BAL", + "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", + "minAmountOut": "1E-18", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" + } + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "2.59", + "symbol": "WETH" + }, + "token_out": { + "amount": "101.017233875979120628", + "symbol": "BAL" + } + } + }, + { + "timestamp": "2020-11-28T02:45:39+00:00", + "tx_hash": "0x8f8103e69c0d624e4e70026d0ed4175b5857450947c69fc9f55de49e309e8abc", + "block_number": "11344387", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + }, + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WETH", + "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "tokenAmountIn": "2.6", "tokenOut_symbol": "BAL", "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", - "minAmountOut": "0", + "minAmountOut": "1E-18", "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } } @@ -698009,26 +698345,21 @@ "action": { "type": "swap", "token_in": { - "amount": "0.849900000000000128", + "amount": "2.6", "symbol": "WETH" }, "token_out": { - "amount": "33.211004317532025209", + "amount": "101.119598064256938717", "symbol": "BAL" } } }, { - "timestamp": "2020-11-28T02:35:37+00:00", - "tx_hash": "0x92eefd6513c55db7528d45e4bed1aed01a062dc826f03c6b6606c45817eb51c8", - "block_number": "11344350", + "timestamp": "2020-11-28T02:45:59+00:00", + "tx_hash": "0xfa9ea868862e94cf2f581fc8b937c4160e1dbd318257d5e086337968d46b5e7e", + "block_number": "11344388", "swap_fee": "0.0015", "denorms": [ - { - "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "token_symbol": "WBTC", - "denorm": "17.000000000" - }, { "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", "token_symbol": "WETH", @@ -698038,38 +698369,43 @@ "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", "token_symbol": "BAL", "denorm": "25.000000000" + }, + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" } ], "contract_call": [ { "type": "swapExactAmountIn", "inputs": { - "tokenIn_symbol": "WETH", - "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "tokenAmountIn": "2.59", - "tokenOut_symbol": "BAL", - "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", - "minAmountOut": "1E-18", - "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" + "tokenIn_symbol": "WBTC", + "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "tokenAmountIn": "1402456", + "tokenOut_symbol": "WETH", + "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "minAmountOut": "0", + "maxPrice": "100433627766186892221372630771322662657637.687111424552206336" } } ], "action": { "type": "swap", "token_in": { - "amount": "2.59", - "symbol": "WETH" + "amount": "1402456", + "symbol": "WBTC" }, "token_out": { - "amount": "101.017233875979120628", - "symbol": "BAL" + "amount": "3.710871571482451281", + "symbol": "WETH" } } }, { - "timestamp": "2020-11-28T02:45:39+00:00", - "tx_hash": "0x8f8103e69c0d624e4e70026d0ed4175b5857450947c69fc9f55de49e309e8abc", - "block_number": "11344387", + "timestamp": "2020-11-28T02:52:46+00:00", + "tx_hash": "0x1d4a6bf51c14ad009e37a4c75ca958000f8c260eb3897dee72a495a19ac5f726", + "block_number": "11344418", "swap_fee": "0.0015", "denorms": [ { @@ -698077,15 +698413,15 @@ "token_symbol": "WBTC", "denorm": "17.000000000" }, - { - "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "token_symbol": "WETH", - "denorm": "8.000000000" - }, { "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", "token_symbol": "BAL", "denorm": "25.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" } ], "contract_call": [ @@ -698094,7 +698430,7 @@ "inputs": { "tokenIn_symbol": "WETH", "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "tokenAmountIn": "2.6", + "tokenAmountIn": "7.815", "tokenOut_symbol": "BAL", "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", "minAmountOut": "1E-18", @@ -698105,66 +698441,18 @@ "action": { "type": "swap", "token_in": { - "amount": "2.6", + "amount": "7.815", "symbol": "WETH" }, "token_out": { - "amount": "101.119598064256938717", + "amount": "300.581474188789765997", "symbol": "BAL" } } }, - { - "timestamp": "2020-11-28T02:45:59+00:00", - "tx_hash": "0xfa9ea868862e94cf2f581fc8b937c4160e1dbd318257d5e086337968d46b5e7e", - "block_number": "11344388", - "swap_fee": "0.0015", - "denorms": [ - { - "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "token_symbol": "WETH", - "denorm": "8.000000000" - }, - { - "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", - "token_symbol": "BAL", - "denorm": "25.000000000" - }, - { - "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "token_symbol": "WBTC", - "denorm": "17.000000000" - } - ], - "contract_call": [ - { - "type": "swapExactAmountIn", - "inputs": { - "tokenIn_symbol": "WBTC", - "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "tokenAmountIn": "1402456", - "tokenOut_symbol": "WETH", - "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "minAmountOut": "0", - "maxPrice": "100433627766186892221372630771322662657637.687111424552206336" - } - } - ], - "action": { - "type": "swap", - "token_in": { - "amount": "1402456", - "symbol": "WBTC" - }, - "token_out": { - "amount": "3.710871571482451281", - "symbol": "WETH" - } - } - }, { "timestamp": "2020-11-28T02:52:46+00:00", - "tx_hash": "0x1d4a6bf51c14ad009e37a4c75ca958000f8c260eb3897dee72a495a19ac5f726", + "tx_hash": "0x4ce49150bdb146c2e566aa44223c14e89bccad14edf77ad7dac6c657066c98e2", "block_number": "11344418", "swap_fee": "0.0015", "denorms": [ @@ -698188,12 +698476,24 @@ { "type": "swapExactAmountIn", "inputs": { - "tokenIn_symbol": "WETH", - "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "tokenAmountIn": "7.815", + "tokenIn_symbol": "WBTC", + "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "tokenAmountIn": "1744975", "tokenOut_symbol": "BAL", "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", - "minAmountOut": "1E-18", + "minAmountOut": "0", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" + } + }, + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "BAL", + "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3D", + "tokenAmountIn": "178.722357694421374368", + "tokenOut_symbol": "WETH", + "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "minAmountOut": "0", "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } } @@ -698201,11 +698501,11 @@ "action": { "type": "swap", "token_in": { - "amount": "7.815", - "symbol": "WETH" + "amount": "1744975", + "symbol": "WBTC" }, "token_out": { - "amount": "300.581474188789765997", + "amount": "178.722357694421374368", "symbol": "BAL" } } @@ -698260,26 +698560,14 @@ ], "action": { "type": "swap", - "tokens_in": [ - { - "amount": "1744975", - "symbol": "WBTC" - }, - { - "amount": "178.722357694421374368", - "symbol": "BAL" - } - ], - "tokens_out": [ - { - "amount": "178.722357694421374368", - "symbol": "BAL" - }, - { - "amount": "4.64646061921896853", - "symbol": "WETH" - } - ] + "token_in": { + "amount": "178.722357694421374368", + "symbol": "BAL" + }, + "token_out": { + "amount": "4.64646061921896853", + "symbol": "WETH" + } } }, { @@ -888958,58 +889246,118 @@ "inputs": { "tokenIn_symbol": "WETH", "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "tokenAmountIn": "6.9157250901169744", + "tokenAmountIn": "6.9157250901169744", + "tokenOut_symbol": "WBTC", + "tokenOut": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "minAmountOut": "0", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" + } + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "6.9157250901169744", + "symbol": "WETH" + }, + "token_out": { + "amount": "3315534", + "symbol": "WBTC" + } + } + }, + { + "timestamp": "2021-01-29T11:12:30+00:00", + "tx_hash": "0x490e05e6fa76e11614647745b4f8399544bddb66cba854e633ea3c0aa1f621dd", + "block_number": "11750445", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + }, + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "BAL", + "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3D", + "tokenAmountIn": "457.804939028978062628", + "tokenOut_symbol": "WETH", + "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "minAmountOut": "1E-18", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" + } + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "457.804939028978062628", + "symbol": "BAL" + }, + "token_out": { + "amount": "8.291038433526788963", + "symbol": "WETH" + } + } + }, + { + "timestamp": "2021-01-29T11:12:30+00:00", + "tx_hash": "0x5af6edd8ecda590e4e333998c5a1340588c95b3883cc6f3a70bc8531bb281348", + "block_number": "11750445", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + }, + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WETH", + "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "tokenAmountIn": "3.3547882965081515", "tokenOut_symbol": "WBTC", "tokenOut": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", "minAmountOut": "0", "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } - } - ], - "action": { - "type": "swap", - "token_in": { - "amount": "6.9157250901169744", - "symbol": "WETH" - }, - "token_out": { - "amount": "3315534", - "symbol": "WBTC" - } - } - }, - { - "timestamp": "2021-01-29T11:12:30+00:00", - "tx_hash": "0x490e05e6fa76e11614647745b4f8399544bddb66cba854e633ea3c0aa1f621dd", - "block_number": "11750445", - "swap_fee": "0.0015", - "denorms": [ - { - "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", - "token_symbol": "BAL", - "denorm": "25.000000000" - }, - { - "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "token_symbol": "WBTC", - "denorm": "17.000000000" }, - { - "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "token_symbol": "WETH", - "denorm": "8.000000000" - } - ], - "contract_call": [ { "type": "swapExactAmountIn", "inputs": { "tokenIn_symbol": "BAL", "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3D", - "tokenAmountIn": "457.804939028978062628", + "tokenAmountIn": "194.337842204855915992", "tokenOut_symbol": "WETH", "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "minAmountOut": "1E-18", + "minAmountOut": "0", "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } } @@ -889017,11 +889365,11 @@ "action": { "type": "swap", "token_in": { - "amount": "457.804939028978062628", + "amount": "194.337842204855915992", "symbol": "BAL" }, "token_out": { - "amount": "8.291038433526788963", + "amount": "3.437922820519754298", "symbol": "WETH" } } @@ -889076,26 +889424,14 @@ ], "action": { "type": "swap", - "tokens_in": [ - { - "amount": "194.337842204855915992", - "symbol": "BAL" - }, - { - "amount": "3.3547882965081515", - "symbol": "WETH" - } - ], - "tokens_out": [ - { - "amount": "3.437922820519754298", - "symbol": "WETH" - }, - { - "amount": "1592883", - "symbol": "WBTC" - } - ] + "token_in": { + "amount": "3.3547882965081515", + "symbol": "WETH" + }, + "token_out": { + "amount": "1592883", + "symbol": "WBTC" + } } }, { @@ -922400,12 +922736,204 @@ { "type": "swapExactAmountIn", "inputs": { - "tokenIn_symbol": "WETH", - "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "tokenAmountIn": "9.208248205830498013", + "tokenIn_symbol": "WETH", + "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "tokenAmountIn": "9.208248205830498013", + "tokenOut_symbol": "BAL", + "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", + "minAmountOut": "1E-18", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" + } + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "9.208248205830498013", + "symbol": "WETH" + }, + "token_out": { + "amount": "426.560770372983734732", + "symbol": "BAL" + } + } + }, + { + "timestamp": "2021-02-10T16:37:31+00:00", + "tx_hash": "0x66f95e92d79e706181e3aa80656ca07bf31005e5ad5b69460f8ca417180cd24f", + "block_number": "11829899", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + }, + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + }, + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WBTC", + "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "tokenAmountIn": "3675804", + "tokenOut_symbol": "WETH", + "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "minAmountOut": "0", + "maxPrice": "100433627766186892221372630771322662657637.687111424552206336" + } + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "3675804", + "symbol": "WBTC" + }, + "token_out": { + "amount": "7.730616455028501622", + "symbol": "WETH" + } + } + }, + { + "timestamp": "2021-02-10T16:37:31+00:00", + "tx_hash": "0x80fd08eaf56c0bf7afe1e10d24bbf3deaca58a6b846e44ec31fd50efed7f2bcc", + "block_number": "11829899", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + }, + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + }, + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WETH", + "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "tokenAmountIn": "9.394098306553806", + "tokenOut_symbol": "WBTC", + "tokenOut": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "minAmountOut": "0", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" + } + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "9.394098306553806", + "symbol": "WETH" + }, + "token_out": { + "amount": "4595091", + "symbol": "WBTC" + } + } + }, + { + "timestamp": "2021-02-10T16:37:31+00:00", + "tx_hash": "0xb08a0cb9ee56a733dc45224e8ca3a3e20c4d8fd2b499c2e10a5a35445baf7a96", + "block_number": "11829899", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + }, + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + }, + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WBTC", + "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "tokenAmountIn": "6517774", + "tokenOut_symbol": "WETH", + "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "minAmountOut": "1E-18", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" + } + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "6517774", + "symbol": "WBTC" + }, + "token_out": { + "amount": "13.351169750329584141", + "symbol": "WETH" + } + } + }, + { + "timestamp": "2021-02-10T16:42:43+00:00", + "tx_hash": "0x955a9816dec5996fb950eec2117ee831e5b22e91f0e5dbb189f3dce6000a22f6", + "block_number": "11829919", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + }, + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WBTC", + "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "tokenAmountIn": "2744607", "tokenOut_symbol": "BAL", "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", - "minAmountOut": "1E-18", + "minAmountOut": "262.390123621586665472", "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } } @@ -922413,67 +922941,19 @@ "action": { "type": "swap", "token_in": { - "amount": "9.208248205830498013", - "symbol": "WETH" - }, - "token_out": { - "amount": "426.560770372983734732", - "symbol": "BAL" - } - } - }, - { - "timestamp": "2021-02-10T16:37:31+00:00", - "tx_hash": "0x66f95e92d79e706181e3aa80656ca07bf31005e5ad5b69460f8ca417180cd24f", - "block_number": "11829899", - "swap_fee": "0.0015", - "denorms": [ - { - "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "token_symbol": "WETH", - "denorm": "8.000000000" - }, - { - "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", - "token_symbol": "BAL", - "denorm": "25.000000000" - }, - { - "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "token_symbol": "WBTC", - "denorm": "17.000000000" - } - ], - "contract_call": [ - { - "type": "swapExactAmountIn", - "inputs": { - "tokenIn_symbol": "WBTC", - "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "tokenAmountIn": "3675804", - "tokenOut_symbol": "WETH", - "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "minAmountOut": "0", - "maxPrice": "100433627766186892221372630771322662657637.687111424552206336" - } - } - ], - "action": { - "type": "swap", - "token_in": { - "amount": "3675804", + "amount": "2744607", "symbol": "WBTC" }, "token_out": { - "amount": "7.730616455028501622", - "symbol": "WETH" + "amount": "264.124431650912038513", + "symbol": "BAL" } } }, { - "timestamp": "2021-02-10T16:37:31+00:00", - "tx_hash": "0x80fd08eaf56c0bf7afe1e10d24bbf3deaca58a6b846e44ec31fd50efed7f2bcc", - "block_number": "11829899", + "timestamp": "2021-02-10T16:43:35+00:00", + "tx_hash": "0x1497a5875f81e489638fc4362c9cbc843424eff9559c5835060cb210765b5e7f", + "block_number": "11829923", "swap_fee": "0.0015", "denorms": [ { @@ -922496,60 +922976,24 @@ { "type": "swapExactAmountIn", "inputs": { - "tokenIn_symbol": "WETH", - "tokenIn": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "tokenAmountIn": "9.394098306553806", + "tokenIn_symbol": "BAL", + "tokenIn": "0xba100000625a3754423978a60c9317c58a424e3D", + "tokenAmountIn": "432.268478048410611308", "tokenOut_symbol": "WBTC", "tokenOut": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", "minAmountOut": "0", "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } - } - ], - "action": { - "type": "swap", - "token_in": { - "amount": "9.394098306553806", - "symbol": "WETH" - }, - "token_out": { - "amount": "4595091", - "symbol": "WBTC" - } - } - }, - { - "timestamp": "2021-02-10T16:37:31+00:00", - "tx_hash": "0xb08a0cb9ee56a733dc45224e8ca3a3e20c4d8fd2b499c2e10a5a35445baf7a96", - "block_number": "11829899", - "swap_fee": "0.0015", - "denorms": [ - { - "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "token_symbol": "WETH", - "denorm": "8.000000000" }, - { - "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", - "token_symbol": "BAL", - "denorm": "25.000000000" - }, - { - "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "token_symbol": "WBTC", - "denorm": "17.000000000" - } - ], - "contract_call": [ { "type": "swapExactAmountIn", "inputs": { "tokenIn_symbol": "WBTC", "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "tokenAmountIn": "6517774", + "tokenAmountIn": "4536373", "tokenOut_symbol": "WETH", "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "minAmountOut": "1E-18", + "minAmountOut": "0", "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } } @@ -922557,63 +923001,15 @@ "action": { "type": "swap", "token_in": { - "amount": "6517774", + "amount": "4536373", "symbol": "WBTC" }, "token_out": { - "amount": "13.351169750329584141", + "amount": "9.731939221680084568", "symbol": "WETH" } } }, - { - "timestamp": "2021-02-10T16:42:43+00:00", - "tx_hash": "0x955a9816dec5996fb950eec2117ee831e5b22e91f0e5dbb189f3dce6000a22f6", - "block_number": "11829919", - "swap_fee": "0.0015", - "denorms": [ - { - "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", - "token_symbol": "BAL", - "denorm": "25.000000000" - }, - { - "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", - "token_symbol": "WETH", - "denorm": "8.000000000" - }, - { - "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "token_symbol": "WBTC", - "denorm": "17.000000000" - } - ], - "contract_call": [ - { - "type": "swapExactAmountIn", - "inputs": { - "tokenIn_symbol": "WBTC", - "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", - "tokenAmountIn": "2744607", - "tokenOut_symbol": "BAL", - "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", - "minAmountOut": "262.390123621586665472", - "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" - } - } - ], - "action": { - "type": "swap", - "token_in": { - "amount": "2744607", - "symbol": "WBTC" - }, - "token_out": { - "amount": "264.124431650912038513", - "symbol": "BAL" - } - } - }, { "timestamp": "2021-02-10T16:43:35+00:00", "tx_hash": "0x1497a5875f81e489638fc4362c9cbc843424eff9559c5835060cb210765b5e7f", @@ -922664,26 +923060,14 @@ ], "action": { "type": "swap", - "tokens_in": [ - { - "amount": "4536373", - "symbol": "WBTC" - }, - { - "amount": "432.268478048410611308", - "symbol": "BAL" - } - ], - "tokens_out": [ - { - "amount": "9.731939221680084568", - "symbol": "WETH" - }, - { - "amount": "4536373", - "symbol": "WBTC" - } - ] + "token_in": { + "amount": "432.268478048410611308", + "symbol": "BAL" + }, + "token_out": { + "amount": "4536373", + "symbol": "WBTC" + } } }, { @@ -941248,26 +941632,74 @@ ], "action": { "type": "swap", - "tokens_in": [ - { - "amount": "3000000", - "symbol": "WBTC" - }, - { - "amount": "5550000", - "symbol": "WBTC" + "token_in": { + "amount": "3000000", + "symbol": "WBTC" + }, + "token_out": { + "amount": "6.588766237903954967", + "symbol": "WETH" + } + } + }, + { + "timestamp": "2021-02-18T05:49:19+00:00", + "tx_hash": "0x1d56f0c7b4d8b29c064a6050ef3f2dabc2264e7beb6bcb7d1b3e714bc307fe76", + "block_number": "11879033", + "swap_fee": "0.0015", + "denorms": [ + { + "token_address": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "token_symbol": "WBTC", + "denorm": "17.000000000" + }, + { + "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "token_symbol": "WETH", + "denorm": "8.000000000" + }, + { + "token_address": "0xba100000625a3754423978a60c9317c58a424e3D", + "token_symbol": "BAL", + "denorm": "25.000000000" + } + ], + "contract_call": [ + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WBTC", + "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "tokenAmountIn": "3000000", + "tokenOut_symbol": "WETH", + "tokenOut": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "minAmountOut": "1E-18", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } - ], - "tokens_out": [ - { - "amount": "6.588766237903954967", - "symbol": "WETH" - }, - { - "amount": "493.687931108906271866", - "symbol": "BAL" + }, + { + "type": "swapExactAmountIn", + "inputs": { + "tokenIn_symbol": "WBTC", + "tokenIn": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "tokenAmountIn": "5550000", + "tokenOut_symbol": "BAL", + "tokenOut": "0xba100000625a3754423978a60c9317c58a424e3D", + "minAmountOut": "1E-18", + "maxPrice": "115792089237316195423570985008687907853269984665640564039457.584007913129639935" } - ] + } + ], + "action": { + "type": "swap", + "token_in": { + "amount": "5550000", + "symbol": "WBTC" + }, + "token_out": { + "amount": "493.687931108906271866", + "symbol": "BAL" + } } }, { diff --git a/data/pulldata.py b/data/pulldata.py index c057f40..4534899 100644 --- a/data/pulldata.py +++ b/data/pulldata.py @@ -347,10 +347,20 @@ def produce_actions(): if events_grouped_by_txhash.get(tx_hash) is None: events_grouped_by_txhash[tx_hash] = [] events_grouped_by_txhash[tx_hash].append(action) - save_pickle(events_grouped_by_txhash, f'{args.pool_address}/events_grouped_by_txhash.pickle') - events_grouped_by_txhash = load_pickle(f'{args.pool_address}/events_grouped_by_txhash.pickle') - - grouped_events = list(map(lambda key: events_grouped_by_txhash[key], events_grouped_by_txhash)) + # save_pickle(events_grouped_by_txhash, f'{args.pool_address}/events_grouped_by_txhash.pickle') + # events_grouped_by_txhash = load_pickle(f'{args.pool_address}/events_grouped_by_txhash.pickle') + + def turn_grouped_by_txhash_events_into_list_and_ungroup_1inch_aggregated_swaps(): + answer = [] + def is_swap(actions): + return all([a.action_type == "swap" for a in actions]) + for k, group in events_grouped_by_txhash.items(): + if len(group) > 1 and is_swap(group): + for i in group: answer.append([i]) + else: + answer.append(group) + return answer + grouped_events = turn_grouped_by_txhash_events_into_list_and_ungroup_1inch_aggregated_swaps() # Remove pool share transfers grouped_events = list(filter(lambda acts: not (len(acts) == 1 and acts[0].action_type == 'transfer'), grouped_events))