From cd01298ba659b07324da26004a610a4b7940db81 Mon Sep 17 00:00:00 2001 From: Shea Ketsdever Date: Sun, 28 Nov 2021 14:51:24 -0800 Subject: [PATCH 1/3] Bancor classifier --- mev_inspect/abis/bancor/BancorNetwork.json | 1 + mev_inspect/classifiers/helpers.py | 37 +++++++++++++ mev_inspect/classifiers/specs/__init__.py | 2 + mev_inspect/classifiers/specs/bancor.py | 48 +++++++++++++++++ mev_inspect/schemas/traces.py | 1 + tests/test_swaps.py | 62 ++++++++++++++++++++-- 6 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 mev_inspect/abis/bancor/BancorNetwork.json create mode 100644 mev_inspect/classifiers/specs/bancor.py diff --git a/mev_inspect/abis/bancor/BancorNetwork.json b/mev_inspect/abis/bancor/BancorNetwork.json new file mode 100644 index 0000000..99a7e83 --- /dev/null +++ b/mev_inspect/abis/bancor/BancorNetwork.json @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"_onlyOwnerCanUpdateRegistry","type":"bool"}],"name":"restrictRegistryUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_register","type":"bool"}],"name":"registerEtherToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"}],"name":"getReturnByPath","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_beneficiary","type":"address"},{"name":"_affiliateAccount","type":"address"},{"name":"_affiliateFee","type":"uint256"}],"name":"claimAndConvertFor2","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"onlyOwnerCanUpdateRegistry","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"updateRegistry","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_affiliateAccount","type":"address"},{"name":"_affiliateFee","type":"uint256"}],"name":"convert2","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"maxAffiliateFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"prevRegistry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"}],"name":"rateByPath","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"etherTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_bancorX","type":"address"},{"name":"_conversionId","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_beneficiary","type":"address"}],"name":"completeXConversion","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_beneficiary","type":"address"},{"name":"_affiliateAccount","type":"address"},{"name":"_affiliateFee","type":"uint256"}],"name":"convertFor2","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_beneficiary","type":"address"}],"name":"claimAndConvertFor","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"restoreRegistry","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_beneficiary","type":"address"},{"name":"_affiliateAccount","type":"address"},{"name":"_affiliateFee","type":"uint256"}],"name":"convertByPath","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_targetBlockchain","type":"bytes32"},{"name":"_targetAccount","type":"bytes32"},{"name":"_conversionId","type":"uint256"}],"name":"xConvert","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"claimAndConvert","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_beneficiary","type":"address"}],"name":"convertFor","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_targetBlockchain","type":"bytes32"},{"name":"_targetAccount","type":"bytes32"},{"name":"_conversionId","type":"uint256"},{"name":"_affiliateAccount","type":"address"},{"name":"_affiliateFee","type":"uint256"}],"name":"xConvert2","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_sourceToken","type":"address"},{"name":"_targetToken","type":"address"}],"name":"conversionPath","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_affiliateAccount","type":"address"},{"name":"_affiliateFee","type":"uint256"}],"name":"claimAndConvert2","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"convert","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_maxAffiliateFee","type":"uint256"}],"name":"setMaxAffiliateFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_registry","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_smartToken","type":"address"},{"indexed":true,"name":"_fromToken","type":"address"},{"indexed":true,"name":"_toToken","type":"address"},{"indexed":false,"name":"_fromAmount","type":"uint256"},{"indexed":false,"name":"_toAmount","type":"uint256"},{"indexed":false,"name":"_trader","type":"address"}],"name":"Conversion","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_prevOwner","type":"address"},{"indexed":true,"name":"_newOwner","type":"address"}],"name":"OwnerUpdate","type":"event"}] \ No newline at end of file diff --git a/mev_inspect/classifiers/helpers.py b/mev_inspect/classifiers/helpers.py index 58d6440..f120005 100644 --- a/mev_inspect/classifiers/helpers.py +++ b/mev_inspect/classifiers/helpers.py @@ -55,6 +55,43 @@ def create_swap_from_transfers( ) +def create_swap_from_transfers_not_including_pool( + trace: DecodedCallTrace, + pool_address: str, + recipient_address: str, + prior_transfers: List[Transfer], + child_transfers: List[Transfer], +) -> Optional[Swap]: + transfers_from_recipient = _filter_transfers( + [*prior_transfers, *child_transfers], from_address=recipient_address + ) + transfers_to_recipient = _filter_transfers( + child_transfers, to_address=recipient_address + ) + + if len(transfers_from_recipient) != 1 or len(transfers_to_recipient) != 1: + return None + + transfer_in = transfers_from_recipient[0] + transfer_out = transfers_to_recipient[0] + + return Swap( + abi_name=trace.abi_name, + transaction_hash=trace.transaction_hash, + block_number=trace.block_number, + trace_address=trace.trace_address, + contract_address=pool_address, + protocol=trace.protocol, + from_address=transfer_in.from_address, + to_address=transfer_out.to_address, + token_in_address=transfer_in.token_address, + token_in_amount=transfer_in.amount, + token_out_address=transfer_out.token_address, + token_out_amount=transfer_out.amount, + error=trace.error, + ) + + def _build_eth_transfer(trace: ClassifiedTrace) -> Transfer: return Transfer( block_number=trace.block_number, diff --git a/mev_inspect/classifiers/specs/__init__.py b/mev_inspect/classifiers/specs/__init__.py index 6874e01..aa5b28a 100644 --- a/mev_inspect/classifiers/specs/__init__.py +++ b/mev_inspect/classifiers/specs/__init__.py @@ -12,6 +12,7 @@ from .zero_ex import ZEROX_CLASSIFIER_SPECS from .balancer import BALANCER_CLASSIFIER_SPECS from .compound import COMPOUND_CLASSIFIER_SPECS from .cryptopunks import CRYPTOPUNKS_CLASSIFIER_SPECS +from .bancor import BANCOR_CLASSIFIER_SPECS ALL_CLASSIFIER_SPECS = ( ERC20_CLASSIFIER_SPECS @@ -23,6 +24,7 @@ ALL_CLASSIFIER_SPECS = ( + BALANCER_CLASSIFIER_SPECS + COMPOUND_CLASSIFIER_SPECS + CRYPTOPUNKS_CLASSIFIER_SPECS + + BANCOR_CLASSIFIER_SPECS ) _SPECS_BY_ABI_NAME_AND_PROTOCOL: Dict[ diff --git a/mev_inspect/classifiers/specs/bancor.py b/mev_inspect/classifiers/specs/bancor.py new file mode 100644 index 0000000..e8b15f6 --- /dev/null +++ b/mev_inspect/classifiers/specs/bancor.py @@ -0,0 +1,48 @@ +from typing import Optional, List +from mev_inspect.schemas.transfers import Transfer +from mev_inspect.schemas.swaps import Swap +from mev_inspect.schemas.traces import ( + DecodedCallTrace, + Protocol, +) +from mev_inspect.schemas.classifiers import ( + ClassifierSpec, + SwapClassifier, +) +from mev_inspect.classifiers.helpers import ( + create_swap_from_transfers_not_including_pool, +) + +BANCOR_NETWORK_ABI_NAME = "BancorNetwork" +BANCOR_NETWORK_CONTRACT_ADDRESS = "0x2F9EC37d6CcFFf1caB21733BdaDEdE11c823cCB0" + + +class BancorSwapClassifier(SwapClassifier): + @staticmethod + def parse_swap( + trace: DecodedCallTrace, + prior_transfers: List[Transfer], + child_transfers: List[Transfer], + ) -> Optional[Swap]: + recipient_address = trace.from_address + + swap = create_swap_from_transfers_not_including_pool( + trace, + BANCOR_NETWORK_CONTRACT_ADDRESS, + recipient_address, + prior_transfers, + child_transfers, + ) + return swap + + +BANCOR_NETWORK_SPEC = ClassifierSpec( + abi_name=BANCOR_NETWORK_ABI_NAME, + protocol=Protocol.bancor, + classifiers={ + "convertByPath(address[],uint256,uint256,address,address,uint256)": BancorSwapClassifier, + }, + valid_contract_addresses=[BANCOR_NETWORK_CONTRACT_ADDRESS], +) + +BANCOR_CLASSIFIER_SPECS = [BANCOR_NETWORK_SPEC] diff --git a/mev_inspect/schemas/traces.py b/mev_inspect/schemas/traces.py index 6b4480b..6ea5862 100644 --- a/mev_inspect/schemas/traces.py +++ b/mev_inspect/schemas/traces.py @@ -47,6 +47,7 @@ class Protocol(Enum): compound_v2 = "compound_v2" cream = "cream" cryptopunks = "cryptopunks" + bancor = "bancor" class ClassifiedTrace(Trace): diff --git a/tests/test_swaps.py b/tests/test_swaps.py index 68e9071..e51c9b6 100644 --- a/tests/test_swaps.py +++ b/tests/test_swaps.py @@ -4,6 +4,10 @@ from mev_inspect.classifiers.specs.uniswap import ( UNISWAP_V2_PAIR_ABI_NAME, UNISWAP_V3_POOL_ABI_NAME, ) +from mev_inspect.classifiers.specs.bancor import ( + BANCOR_NETWORK_ABI_NAME, + BANCOR_NETWORK_CONTRACT_ADDRESS, +) from mev_inspect.schemas.traces import Protocol from .helpers import ( @@ -23,12 +27,14 @@ def test_swaps( first_transaction_hash, second_transaction_hash, third_transaction_hash, - ] = get_transaction_hashes(3) + fourth_transaction_hash, + ] = get_transaction_hashes(4) [ alice_address, bob_address, carl_address, + danielle_address, first_token_in_address, first_token_out_address, first_pool_address, @@ -38,7 +44,10 @@ def test_swaps( third_token_in_address, third_token_out_address, third_pool_address, - ] = get_addresses(12) + fourth_token_in_address, + fourth_token_out_address, + first_converter_address, + ] = get_addresses(16) first_token_in_amount = 10 first_token_out_amount = 20 @@ -46,6 +55,8 @@ def test_swaps( second_token_out_amount = 40 third_token_in_amount = 50 third_token_out_amount = 60 + fourth_token_in_amount = 70 + fourth_token_out_amount = 80 traces = [ make_unknown_trace(block_number, first_transaction_hash, []), @@ -139,11 +150,41 @@ def test_swaps( recipient_address=bob_address, recipient_input_key="recipient", ), + make_transfer_trace( + block_number, + fourth_transaction_hash, + trace_address=[2], + from_address=danielle_address, + to_address=first_converter_address, + token_address=fourth_token_in_address, + amount=fourth_token_in_amount, + ), + make_transfer_trace( + block_number, + fourth_transaction_hash, + trace_address=[1, 2], + from_address=first_converter_address, + to_address=danielle_address, + token_address=fourth_token_out_address, + amount=fourth_token_out_amount, + ), + make_swap_trace( + block_number, + fourth_transaction_hash, + trace_address=[], + from_address=danielle_address, + contract_address=BANCOR_NETWORK_CONTRACT_ADDRESS, + abi_name=BANCOR_NETWORK_ABI_NAME, + protocol=Protocol.bancor, + function_signature="convertByPath(address[],uint256,uint256,address,address,uint256)", + recipient_address=danielle_address, + recipient_input_key="recipient", + ), ] swaps = get_swaps(traces) - assert len(swaps) == 3 + assert len(swaps) == 4 for swap in swaps: if swap.abi_name == UNISWAP_V2_PAIR_ABI_NAME: @@ -152,6 +193,8 @@ def test_swaps( uni_v3_swap = swap elif swap.abi_name == BALANCER_V1_POOL_ABI_NAME: bal_v1_swap = swap + elif swap.abi_name == BANCOR_NETWORK_ABI_NAME: + bancor_swap = swap else: assert False @@ -193,3 +236,16 @@ def test_swaps( assert bal_v1_swap.token_in_amount == third_token_in_amount assert bal_v1_swap.token_out_address == third_token_out_address assert bal_v1_swap.token_out_amount == third_token_out_amount + + assert bancor_swap.abi_name == BANCOR_NETWORK_ABI_NAME + assert bancor_swap.transaction_hash == fourth_transaction_hash + assert bancor_swap.block_number == block_number + assert bancor_swap.trace_address == [] + assert bancor_swap.protocol == Protocol.bancor + assert bancor_swap.contract_address == BANCOR_NETWORK_CONTRACT_ADDRESS + assert bancor_swap.from_address == danielle_address + assert bancor_swap.to_address == danielle_address + assert bancor_swap.token_in_address == fourth_token_in_address + assert bancor_swap.token_in_amount == fourth_token_in_amount + assert bancor_swap.token_out_address == fourth_token_out_address + assert bancor_swap.token_out_amount == fourth_token_out_amount From 7d7f78bfb12ef2183a66658aa577faf5b10f0b0d Mon Sep 17 00:00:00 2001 From: Shea Ketsdever Date: Sun, 28 Nov 2021 16:02:41 -0800 Subject: [PATCH 2/3] Fix int<>timestamp bug --- mev_inspect/crud/blocks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mev_inspect/crud/blocks.py b/mev_inspect/crud/blocks.py index 3639ba8..c634795 100644 --- a/mev_inspect/crud/blocks.py +++ b/mev_inspect/crud/blocks.py @@ -1,3 +1,4 @@ +import datetime from mev_inspect.schemas.blocks import Block @@ -20,7 +21,7 @@ def write_block( "INSERT INTO blocks (block_number, block_timestamp) VALUES (:block_number, :block_timestamp)", params={ "block_number": block.block_number, - "block_timestamp": block.block_timestamp, + "block_timestamp": datetime.datetime.fromtimestamp(block.block_timestamp), }, ) db_session.commit() From 37e6900f46072dfcb7f8eb0560d50d923e003757 Mon Sep 17 00:00:00 2001 From: Shea Ketsdever Date: Thu, 2 Dec 2021 21:08:45 -0500 Subject: [PATCH 3/3] Rename create_swap functions --- mev_inspect/classifiers/helpers.py | 4 ++-- mev_inspect/classifiers/specs/balancer.py | 4 ++-- mev_inspect/classifiers/specs/bancor.py | 4 ++-- mev_inspect/classifiers/specs/curve.py | 4 ++-- mev_inspect/classifiers/specs/uniswap.py | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mev_inspect/classifiers/helpers.py b/mev_inspect/classifiers/helpers.py index f120005..064267c 100644 --- a/mev_inspect/classifiers/helpers.py +++ b/mev_inspect/classifiers/helpers.py @@ -6,7 +6,7 @@ from mev_inspect.schemas.transfers import Transfer, ETH_TOKEN_ADDRESS from mev_inspect.schemas.traces import DecodedCallTrace, ClassifiedTrace -def create_swap_from_transfers( +def create_swap_from_pool_transfers( trace: DecodedCallTrace, recipient_address: str, prior_transfers: List[Transfer], @@ -55,7 +55,7 @@ def create_swap_from_transfers( ) -def create_swap_from_transfers_not_including_pool( +def create_swap_from_recipient_transfers( trace: DecodedCallTrace, pool_address: str, recipient_address: str, diff --git a/mev_inspect/classifiers/specs/balancer.py b/mev_inspect/classifiers/specs/balancer.py index 89ae1f1..c3ad21a 100644 --- a/mev_inspect/classifiers/specs/balancer.py +++ b/mev_inspect/classifiers/specs/balancer.py @@ -9,7 +9,7 @@ from mev_inspect.schemas.classifiers import ( ClassifierSpec, SwapClassifier, ) -from mev_inspect.classifiers.helpers import create_swap_from_transfers +from mev_inspect.classifiers.helpers import create_swap_from_pool_transfers BALANCER_V1_POOL_ABI_NAME = "BPool" @@ -24,7 +24,7 @@ class BalancerSwapClassifier(SwapClassifier): recipient_address = trace.from_address - swap = create_swap_from_transfers( + swap = create_swap_from_pool_transfers( trace, recipient_address, prior_transfers, child_transfers ) return swap diff --git a/mev_inspect/classifiers/specs/bancor.py b/mev_inspect/classifiers/specs/bancor.py index e8b15f6..f4a8663 100644 --- a/mev_inspect/classifiers/specs/bancor.py +++ b/mev_inspect/classifiers/specs/bancor.py @@ -10,7 +10,7 @@ from mev_inspect.schemas.classifiers import ( SwapClassifier, ) from mev_inspect.classifiers.helpers import ( - create_swap_from_transfers_not_including_pool, + create_swap_from_recipient_transfers, ) BANCOR_NETWORK_ABI_NAME = "BancorNetwork" @@ -26,7 +26,7 @@ class BancorSwapClassifier(SwapClassifier): ) -> Optional[Swap]: recipient_address = trace.from_address - swap = create_swap_from_transfers_not_including_pool( + swap = create_swap_from_recipient_transfers( trace, BANCOR_NETWORK_CONTRACT_ADDRESS, recipient_address, diff --git a/mev_inspect/classifiers/specs/curve.py b/mev_inspect/classifiers/specs/curve.py index 2762725..a395757 100644 --- a/mev_inspect/classifiers/specs/curve.py +++ b/mev_inspect/classifiers/specs/curve.py @@ -10,7 +10,7 @@ from mev_inspect.schemas.classifiers import ( ClassifierSpec, SwapClassifier, ) -from mev_inspect.classifiers.helpers import create_swap_from_transfers +from mev_inspect.classifiers.helpers import create_swap_from_pool_transfers class CurveSwapClassifier(SwapClassifier): @@ -23,7 +23,7 @@ class CurveSwapClassifier(SwapClassifier): recipient_address = trace.from_address - swap = create_swap_from_transfers( + swap = create_swap_from_pool_transfers( trace, recipient_address, prior_transfers, child_transfers ) return swap diff --git a/mev_inspect/classifiers/specs/uniswap.py b/mev_inspect/classifiers/specs/uniswap.py index ce8b634..489078c 100644 --- a/mev_inspect/classifiers/specs/uniswap.py +++ b/mev_inspect/classifiers/specs/uniswap.py @@ -9,7 +9,7 @@ from mev_inspect.schemas.classifiers import ( ClassifierSpec, SwapClassifier, ) -from mev_inspect.classifiers.helpers import create_swap_from_transfers +from mev_inspect.classifiers.helpers import create_swap_from_pool_transfers UNISWAP_V2_PAIR_ABI_NAME = "UniswapV2Pair" @@ -26,7 +26,7 @@ class UniswapV3SwapClassifier(SwapClassifier): recipient_address = trace.inputs.get("recipient", trace.from_address) - swap = create_swap_from_transfers( + swap = create_swap_from_pool_transfers( trace, recipient_address, prior_transfers, child_transfers ) return swap @@ -42,7 +42,7 @@ class UniswapV2SwapClassifier(SwapClassifier): recipient_address = trace.inputs.get("to", trace.from_address) - swap = create_swap_from_transfers( + swap = create_swap_from_pool_transfers( trace, recipient_address, prior_transfers, child_transfers ) return swap