2828from web3 ._utils .contract_sources .contract_data .fallback_function_contract import (
2929 FALLBACK_FUNCTION_CONTRACT_DATA ,
3030)
31+ from web3 ._utils .contract_sources .contract_data .function_name_tester_contract import (
32+ FUNCTION_NAME_TESTER_CONTRACT_ABI ,
33+ FUNCTION_NAME_TESTER_CONTRACT_DATA ,
34+ )
3135from web3 ._utils .contract_sources .contract_data .math_contract import (
3236 MATH_CONTRACT_ABI ,
3337 MATH_CONTRACT_BYTECODE ,
5559 TUPLE_CONTRACT_DATA ,
5660)
5761
62+ # --- function name tester contract --- #
63+
64+
65+ @pytest .fixture (scope = "session" )
66+ def function_name_tester_contract_abi ():
67+ return FUNCTION_NAME_TESTER_CONTRACT_ABI
68+
69+
70+ @pytest .fixture
71+ def function_name_tester_contract (w3 , address_conversion_func ):
72+ function_name_tester_contract_factory = w3 .eth .contract (
73+ ** FUNCTION_NAME_TESTER_CONTRACT_DATA
74+ )
75+ return deploy (w3 , function_name_tester_contract_factory , address_conversion_func )
76+
77+
78+ # --- math contract --- #
79+
5880
5981@pytest .fixture (scope = "session" )
6082def math_contract_bytecode ():
@@ -81,6 +103,9 @@ def math_contract(w3, math_contract_factory, address_conversion_func):
81103 return deploy (w3 , math_contract_factory , address_conversion_func )
82104
83105
106+ # --- constructor contracts --- #
107+
108+
84109@pytest .fixture
85110def simple_constructor_contract_factory (w3 ):
86111 return w3 .eth .contract (** SIMPLE_CONSTRUCTOR_CONTRACT_DATA )
@@ -113,6 +138,9 @@ def contract_with_constructor_address(
113138 )
114139
115140
141+ # --- address reflector contract --- #
142+
143+
116144@pytest .fixture
117145def address_reflector_contract (w3 , address_conversion_func ):
118146 address_reflector_contract_factory = w3 .eth .contract (
@@ -121,6 +149,9 @@ def address_reflector_contract(w3, address_conversion_func):
121149 return deploy (w3 , address_reflector_contract_factory , address_conversion_func )
122150
123151
152+ # --- string contract --- #
153+
154+
124155@pytest .fixture (scope = "session" )
125156def string_contract_data ():
126157 return STRING_CONTRACT_DATA
@@ -153,6 +184,9 @@ def non_strict_string_contract(
153184 )
154185
155186
187+ # --- emitter contract --- #
188+
189+
156190@pytest .fixture
157191def non_strict_emitter (
158192 w3_non_strict_abi ,
@@ -180,6 +214,9 @@ def non_strict_emitter(
180214 return emitter_contract
181215
182216
217+ # --- event contract --- #
218+
219+
183220@pytest .fixture
184221def event_contract (
185222 w3 ,
@@ -223,6 +260,9 @@ def indexed_event_contract(
223260 return indexed_event_contract
224261
225262
263+ # --- arrays contract --- #
264+
265+
226266# bytes_32 = [keccak('0'), keccak('1')]
227267BYTES32_ARRAY = [
228268 b"\x04 HR\xb2 \xa6 p\xad \xe5 @~x\xfb (c\xc5 \x1d \xe9 \xfc \xb9 eB\xa0 q\x86 \xfe :\xed \xa6 \xbb \x8a \x11 m" , # noqa: E501
@@ -255,12 +295,18 @@ def non_strict_arrays_contract(w3_non_strict_abi, address_conversion_func):
255295 )
256296
257297
298+ # --- payable tester contract --- #
299+
300+
258301@pytest .fixture
259302def payable_tester_contract (w3 , address_conversion_func ):
260303 payable_tester_contract_factory = w3 .eth .contract (** PAYABLE_TESTER_CONTRACT_DATA )
261304 return deploy (w3 , payable_tester_contract_factory , address_conversion_func )
262305
263306
307+ # --- fixed reflector contract --- #
308+
309+
264310# no matter the function selector, this will return back the 32 bytes of data supplied
265311FIXED_REFLECTOR_CONTRACT_BYTECODE = "0x610011566020600460003760206000f3005b61000461001103610004600039610004610011036000f3" # noqa: E501
266312# reference source used to generate it:
@@ -306,6 +352,9 @@ def fixed_reflector_contract(w3, address_conversion_func):
306352 return deploy (w3 , fixed_reflector_contract_factory , address_conversion_func )
307353
308354
355+ # --- test data and functions contracts --- #
356+
357+
309358@pytest .fixture
310359def fallback_function_contract (w3 , address_conversion_func ):
311360 fallback_function_contract_factory = w3 .eth .contract (
@@ -387,6 +436,9 @@ def some_address(address_conversion_func):
387436 return address_conversion_func ("0x5B2063246F2191f18F2675ceDB8b28102e957458" )
388437
389438
439+ # --- invoke contract --- #
440+
441+
390442def invoke_contract (
391443 api_call_desig = "call" ,
392444 contract = None ,
@@ -444,6 +496,16 @@ async def async_math_contract(
444496 )
445497
446498
499+ @pytest_asyncio .fixture
500+ async def async_function_name_tester_contract (async_w3 , address_conversion_func ):
501+ function_name_tester_contract_factory = async_w3 .eth .contract (
502+ ** FUNCTION_NAME_TESTER_CONTRACT_DATA
503+ )
504+ return await async_deploy (
505+ async_w3 , function_name_tester_contract_factory , address_conversion_func
506+ )
507+
508+
447509@pytest .fixture
448510def async_simple_constructor_contract_factory (async_w3 ):
449511 return async_w3 .eth .contract (** SIMPLE_CONSTRUCTOR_CONTRACT_DATA )
0 commit comments