From 45c9980a7994ef2b16c2066fbde137a3bbde9332 Mon Sep 17 00:00:00 2001 From: Gui Heise Date: Fri, 19 Nov 2021 11:00:14 -0500 Subject: [PATCH] Add contract_address to tests --- tests/helpers.py | 4 ++-- tests/test_arbitrages.py | 14 +++++++------- tests/test_swaps.py | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index d28e990..bae7b30 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -44,7 +44,7 @@ def make_swap_trace( transaction_hash: str, trace_address: List[int], from_address: str, - pool_address: str, + contract_address: str, abi_name: str, function_signature: str, protocol: Optional[Protocol], @@ -60,7 +60,7 @@ def make_swap_trace( subtraces=0, classification=Classification.swap, from_address=from_address, - to_address=pool_address, + to_address=contract_address, function_name="swap", function_signature=function_signature, inputs={recipient_input_key: recipient_address}, diff --git a/tests/test_arbitrages.py b/tests/test_arbitrages.py index 5ac6d52..fb07e9d 100644 --- a/tests/test_arbitrages.py +++ b/tests/test_arbitrages.py @@ -32,7 +32,7 @@ def test_two_pool_arbitrage(get_transaction_hashes, get_addresses): transaction_hash=transaction_hash, block_number=block_number, trace_address=[0], - pool_address=first_pool_address, + contract_address=first_pool_address, from_address=account_address, to_address=second_pool_address, token_in_address=first_token_address, @@ -45,7 +45,7 @@ def test_two_pool_arbitrage(get_transaction_hashes, get_addresses): transaction_hash=transaction_hash, block_number=block_number, trace_address=[1], - pool_address=second_pool_address, + contract_address=second_pool_address, from_address=first_pool_address, to_address=account_address, token_in_address=second_token_address, @@ -60,7 +60,7 @@ def test_two_pool_arbitrage(get_transaction_hashes, get_addresses): transaction_hash=transaction_hash, block_number=block_number, trace_address=[2, 0], - pool_address=unrelated_pool_address, + contract_address=unrelated_pool_address, from_address=account_address, to_address=account_address, token_in_address=second_token_address, @@ -113,7 +113,7 @@ def test_three_pool_arbitrage(get_transaction_hashes, get_addresses): transaction_hash=transaction_hash, block_number=block_number, trace_address=[0], - pool_address=first_pool_address, + contract_address=first_pool_address, from_address=account_address, to_address=second_pool_address, token_in_address=first_token_address, @@ -126,7 +126,7 @@ def test_three_pool_arbitrage(get_transaction_hashes, get_addresses): transaction_hash=transaction_hash, block_number=block_number, trace_address=[1], - pool_address=second_pool_address, + contract_address=second_pool_address, from_address=first_pool_address, to_address=third_pool_address, token_in_address=second_token_address, @@ -139,7 +139,7 @@ def test_three_pool_arbitrage(get_transaction_hashes, get_addresses): transaction_hash=transaction_hash, block_number=block_number, trace_address=[2], - pool_address=third_pool_address, + contract_address=third_pool_address, from_address=second_pool_address, to_address=account_address, token_in_address=third_token_address, @@ -220,7 +220,7 @@ def create_generic_swap( transaction_hash="0xfake", block_number=0, trace_address=trace_address, - pool_address="0xfake", + contract_address="0xfake", from_address="0xfake", to_address="0xfake", token_in_address=tok_a, diff --git a/tests/test_swaps.py b/tests/test_swaps.py index a4fdefa..68e9071 100644 --- a/tests/test_swaps.py +++ b/tests/test_swaps.py @@ -63,7 +63,7 @@ def test_swaps( first_transaction_hash, trace_address=[1], from_address=alice_address, - pool_address=first_pool_address, + contract_address=first_pool_address, abi_name=UNISWAP_V2_PAIR_ABI_NAME, protocol=None, function_signature="swap(uint256,uint256,address,bytes)", @@ -84,7 +84,7 @@ def test_swaps( second_transaction_hash, trace_address=[], from_address=bob_address, - pool_address=second_pool_address, + contract_address=second_pool_address, abi_name=UNISWAP_V3_POOL_ABI_NAME, protocol=None, function_signature="swap(address,bool,int256,uint160,bytes)", @@ -132,7 +132,7 @@ def test_swaps( third_transaction_hash, trace_address=[6], from_address=bob_address, - pool_address=third_pool_address, + contract_address=third_pool_address, abi_name=BALANCER_V1_POOL_ABI_NAME, protocol=Protocol.balancer_v1, function_signature="swapExactAmountIn(address,uint256,address,uint256,uint256)", @@ -160,7 +160,7 @@ def test_swaps( assert uni_v2_swap.block_number == block_number assert uni_v2_swap.trace_address == [1] assert uni_v2_swap.protocol is None - assert uni_v2_swap.pool_address == first_pool_address + assert uni_v2_swap.contract_address == first_pool_address assert uni_v2_swap.from_address == alice_address assert uni_v2_swap.to_address == bob_address assert uni_v2_swap.token_in_address == first_token_in_address @@ -173,7 +173,7 @@ def test_swaps( assert uni_v3_swap.block_number == block_number assert uni_v3_swap.trace_address == [] assert uni_v3_swap.protocol is None - assert uni_v3_swap.pool_address == second_pool_address + assert uni_v3_swap.contract_address == second_pool_address assert uni_v3_swap.from_address == bob_address assert uni_v3_swap.to_address == carl_address assert uni_v3_swap.token_in_address == second_token_in_address @@ -186,7 +186,7 @@ def test_swaps( assert bal_v1_swap.block_number == block_number assert bal_v1_swap.trace_address == [6] assert bal_v1_swap.protocol == Protocol.balancer_v1 - assert bal_v1_swap.pool_address == third_pool_address + assert bal_v1_swap.contract_address == third_pool_address assert bal_v1_swap.from_address == bob_address assert bal_v1_swap.to_address == bob_address assert bal_v1_swap.token_in_address == third_token_in_address