50
50
51
51
@pytest .fixture
52
52
def tuple_contract (w3 , address_conversion_func ):
53
- tuple_contract_instance = w3 .eth .contract (** TUPLE_CONTRACT_DATA )
54
- return deploy (w3 , tuple_contract_instance , address_conversion_func )
53
+ tuple_contract_factory = w3 .eth .contract (** TUPLE_CONTRACT_DATA )
54
+ return deploy (w3 , tuple_contract_factory , address_conversion_func )
55
55
56
56
57
57
@pytest .fixture
58
58
def nested_tuple_contract (w3 , address_conversion_func ):
59
- nested_tuple_contract_instance = w3 .eth .contract (** NESTED_TUPLE_CONTRACT_DATA )
60
- return deploy (w3 , nested_tuple_contract_instance , address_conversion_func )
59
+ nested_tuple_contract_factory = w3 .eth .contract (** NESTED_TUPLE_CONTRACT_DATA )
60
+ return deploy (w3 , nested_tuple_contract_factory , address_conversion_func )
61
61
62
62
63
63
@pytest .fixture (params = [b"\x04 \x06 " , "0x0406" ])
64
64
def bytes_contract (w3 , request , address_conversion_func ):
65
- bytes_contract_instance = w3 .eth .contract (** BYTES_CONTRACT_DATA )
65
+ bytes_contract_factory = w3 .eth .contract (** BYTES_CONTRACT_DATA )
66
66
return deploy (
67
- w3 , bytes_contract_instance , address_conversion_func , args = [request .param ]
67
+ w3 , bytes_contract_factory , address_conversion_func , args = [request .param ]
68
68
)
69
69
70
70
@@ -74,12 +74,12 @@ def non_strict_bytes_contract(
74
74
request ,
75
75
address_conversion_func ,
76
76
):
77
- non_strict_bytes_contract_instance = w3_non_strict_abi .eth .contract (
77
+ non_strict_bytes_contract_factory = w3_non_strict_abi .eth .contract (
78
78
** BYTES_CONTRACT_DATA
79
79
)
80
80
return deploy (
81
81
w3_non_strict_abi ,
82
- non_strict_bytes_contract_instance ,
82
+ non_strict_bytes_contract_factory ,
83
83
address_conversion_func ,
84
84
args = [request .param ],
85
85
)
@@ -91,7 +91,7 @@ def call_transaction():
91
91
92
92
93
93
@pytest .fixture
94
- def bytes32_contract_instance (w3 ):
94
+ def bytes32_contract_factory (w3 ):
95
95
return w3 .eth .contract (** BYTES32_CONTRACT_DATA )
96
96
97
97
@@ -101,48 +101,48 @@ def bytes32_contract_instance(w3):
101
101
HexBytes ("0406040604060406040604060406040604060406040604060406040604060406" ),
102
102
]
103
103
)
104
- def bytes32_contract (w3 , bytes32_contract_instance , request , address_conversion_func ):
104
+ def bytes32_contract (w3 , bytes32_contract_factory , request , address_conversion_func ):
105
105
return deploy (
106
- w3 , bytes32_contract_instance , address_conversion_func , args = [request .param ]
106
+ w3 , bytes32_contract_factory , address_conversion_func , args = [request .param ]
107
107
)
108
108
109
109
110
110
@pytest .fixture
111
- def undeployed_math_contract (math_contract_instance , address_conversion_func ):
111
+ def undeployed_math_contract (math_contract_factory , address_conversion_func ):
112
112
empty_address = address_conversion_func (
113
113
"0x000000000000000000000000000000000000dEaD"
114
114
)
115
- _undeployed_math_contract = math_contract_instance (address = empty_address )
115
+ _undeployed_math_contract = math_contract_factory (address = empty_address )
116
116
return _undeployed_math_contract
117
117
118
118
119
119
@pytest .fixture
120
120
def mismatched_math_contract (
121
- w3 , string_contract_instance , math_contract_instance , address_conversion_func
121
+ w3 , string_contract_factory , math_contract_factory , address_conversion_func
122
122
):
123
- deploy_txn = string_contract_instance .constructor ("Caqalai" ).transact ()
123
+ deploy_txn = string_contract_factory .constructor ("Caqalai" ).transact ()
124
124
deploy_receipt = w3 .eth .wait_for_transaction_receipt (deploy_txn )
125
125
assert deploy_receipt is not None
126
126
address = address_conversion_func (deploy_receipt ["contractAddress" ])
127
- _mismatched_math_contract = math_contract_instance (address = address )
127
+ _mismatched_math_contract = math_contract_factory (address = address )
128
128
return _mismatched_math_contract
129
129
130
130
131
131
def test_deploy_raises_due_to_strict_byte_checking_by_default (
132
- w3 , bytes32_contract_instance , address_conversion_func
132
+ w3 , bytes32_contract_factory , address_conversion_func
133
133
):
134
134
with pytest .raises (TypeError ):
135
135
deploy (
136
136
w3 ,
137
- bytes32_contract_instance ,
137
+ bytes32_contract_factory ,
138
138
address_conversion_func ,
139
139
args = ["0406040604060406040604060406040604060406040604060406040604060406" ],
140
140
)
141
141
142
142
143
- def test_invalid_address_in_deploy_arg (contract_with_constructor_address_instance ):
143
+ def test_invalid_address_in_deploy_arg (contract_with_constructor_address_factory ):
144
144
with pytest .raises (InvalidAddress ):
145
- contract_with_constructor_address_instance .constructor (
145
+ contract_with_constructor_address_factory .constructor (
146
146
"0xd3cda913deb6f67967b99d67acdfa1712c293601" ,
147
147
).transact ()
148
148
@@ -304,14 +304,14 @@ def test_call_read_address_variable(contract_with_constructor_address, call):
304
304
assert result == "0xd3CdA913deB6f67967B99D67aCDFa1712C293601"
305
305
306
306
307
- def test_init_with_ens_name_arg (w3 , contract_with_constructor_address_instance , call ):
307
+ def test_init_with_ens_name_arg (w3 , contract_with_constructor_address_factory , call ):
308
308
with contract_ens_addresses (
309
- contract_with_constructor_address_instance ,
309
+ contract_with_constructor_address_factory ,
310
310
[("arg-name.eth" , "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413" )],
311
311
):
312
312
address_contract = deploy (
313
313
w3 ,
314
- contract_with_constructor_address_instance ,
314
+ contract_with_constructor_address_factory ,
315
315
args = [
316
316
"arg-name.eth" ,
317
317
],
@@ -1015,37 +1015,37 @@ def test_changing_default_block_identifier(w3, math_contract):
1015
1015
1016
1016
@pytest_asyncio .fixture
1017
1017
async def async_tuple_contract (async_w3 , address_conversion_func ):
1018
- async_tuple_contract_instance = async_w3 .eth .contract (** TUPLE_CONTRACT_DATA )
1018
+ async_tuple_contract_factory = async_w3 .eth .contract (** TUPLE_CONTRACT_DATA )
1019
1019
return await async_deploy (
1020
- async_w3 , async_tuple_contract_instance , address_conversion_func
1020
+ async_w3 , async_tuple_contract_factory , address_conversion_func
1021
1021
)
1022
1022
1023
1023
1024
1024
@pytest_asyncio .fixture
1025
1025
async def async_nested_tuple_contract (async_w3 , address_conversion_func ):
1026
- async_nested_tuple_contract_instance = async_w3 .eth .contract (
1026
+ async_nested_tuple_contract_factory = async_w3 .eth .contract (
1027
1027
** NESTED_TUPLE_CONTRACT_DATA
1028
1028
)
1029
1029
return await async_deploy (
1030
- async_w3 , async_nested_tuple_contract_instance , address_conversion_func
1030
+ async_w3 , async_nested_tuple_contract_factory , address_conversion_func
1031
1031
)
1032
1032
1033
1033
1034
1034
@pytest .fixture
1035
- def async_bytes_contract_instance (async_w3 ):
1035
+ def async_bytes_contract_factory (async_w3 ):
1036
1036
return async_w3 .eth .contract (** BYTES_CONTRACT_DATA )
1037
1037
1038
1038
1039
1039
@pytest_asyncio .fixture (params = [b"\x04 \x06 " , "0x0406" ])
1040
1040
async def async_bytes_contract (
1041
1041
async_w3 ,
1042
1042
request ,
1043
- async_bytes_contract_instance ,
1043
+ async_bytes_contract_factory ,
1044
1044
address_conversion_func ,
1045
1045
):
1046
1046
return await async_deploy (
1047
1047
async_w3 ,
1048
- async_bytes_contract_instance ,
1048
+ async_bytes_contract_factory ,
1049
1049
address_conversion_func ,
1050
1050
args = [request .param ],
1051
1051
)
@@ -1058,45 +1058,45 @@ async def async_bytes_contract(
1058
1058
],
1059
1059
)
1060
1060
async def async_bytes32_contract (async_w3 , request , address_conversion_func ):
1061
- async_bytes32_contract_instance = async_w3 .eth .contract (** BYTES32_CONTRACT_DATA )
1061
+ async_bytes32_contract_factory = async_w3 .eth .contract (** BYTES32_CONTRACT_DATA )
1062
1062
return await async_deploy (
1063
1063
async_w3 ,
1064
- async_bytes32_contract_instance ,
1064
+ async_bytes32_contract_factory ,
1065
1065
address_conversion_func ,
1066
1066
args = [request .param ],
1067
1067
)
1068
1068
1069
1069
1070
1070
@pytest_asyncio .fixture
1071
1071
async def async_undeployed_math_contract (
1072
- async_math_contract_instance , address_conversion_func
1072
+ async_math_contract_factory , address_conversion_func
1073
1073
):
1074
1074
empty_address = address_conversion_func (
1075
1075
"0x000000000000000000000000000000000000dEaD"
1076
1076
)
1077
- _undeployed_math_contract = async_math_contract_instance (address = empty_address )
1077
+ _undeployed_math_contract = async_math_contract_factory (address = empty_address )
1078
1078
return _undeployed_math_contract
1079
1079
1080
1080
1081
1081
@pytest_asyncio .fixture
1082
1082
async def async_mismatched_math_contract (
1083
1083
async_w3 ,
1084
- async_string_contract_instance ,
1085
- async_math_contract_instance ,
1084
+ async_string_contract_factory ,
1085
+ async_math_contract_factory ,
1086
1086
address_conversion_func ,
1087
1087
):
1088
- deploy_txn = await async_string_contract_instance .constructor ("Caqalai" ).transact ()
1088
+ deploy_txn = await async_string_contract_factory .constructor ("Caqalai" ).transact ()
1089
1089
deploy_receipt = await async_w3 .eth .wait_for_transaction_receipt (deploy_txn )
1090
1090
assert deploy_receipt is not None
1091
1091
address = address_conversion_func (deploy_receipt ["contractAddress" ])
1092
- _mismatched_math_contract = async_math_contract_instance (address = address )
1092
+ _mismatched_math_contract = async_math_contract_factory (address = address )
1093
1093
return _mismatched_math_contract
1094
1094
1095
1095
1096
1096
@pytest .fixture
1097
1097
@pytest .mark .asyncio
1098
1098
async def test_async_deploy_raises_due_to_strict_byte_checking_by_default (
1099
- async_w3 , async_bytes_contract_instance , address_conversion_func
1099
+ async_w3 , async_bytes_contract_factory , address_conversion_func
1100
1100
):
1101
1101
with pytest .raises (
1102
1102
TypeError ,
@@ -1105,7 +1105,7 @@ async def test_async_deploy_raises_due_to_strict_byte_checking_by_default(
1105
1105
):
1106
1106
await async_deploy (
1107
1107
async_w3 ,
1108
- async_bytes_contract_instance ,
1108
+ async_bytes_contract_factory ,
1109
1109
address_conversion_func ,
1110
1110
args = ["0406" ],
1111
1111
)
@@ -1118,12 +1118,12 @@ async def test_async_deploy_with_non_strict_abi_check(
1118
1118
address_conversion_func ,
1119
1119
args ,
1120
1120
):
1121
- async_non_strict_bytes_contract_instance = async_w3_non_strict_abi .eth .contract (
1121
+ async_non_strict_bytes_contract_factory = async_w3_non_strict_abi .eth .contract (
1122
1122
** BYTES_CONTRACT_DATA
1123
1123
)
1124
1124
deployed_contract = await async_deploy (
1125
1125
async_w3_non_strict_abi ,
1126
- async_non_strict_bytes_contract_instance ,
1126
+ async_non_strict_bytes_contract_factory ,
1127
1127
address_conversion_func ,
1128
1128
args = [args ],
1129
1129
)
@@ -1133,10 +1133,10 @@ async def test_async_deploy_with_non_strict_abi_check(
1133
1133
1134
1134
@pytest .mark .asyncio
1135
1135
async def test_async_invalid_address_in_deploy_arg (
1136
- async_constructor_with_address_arg_contract_instance ,
1136
+ async_constructor_with_address_arg_contract_factory ,
1137
1137
):
1138
1138
with pytest .raises (InvalidAddress ):
1139
- await async_constructor_with_address_arg_contract_instance .constructor (
1139
+ await async_constructor_with_address_arg_contract_factory .constructor (
1140
1140
"0xd3cda913deb6f67967b99d67acdfa1712c293601" ,
1141
1141
).transact ()
1142
1142
@@ -1308,15 +1308,15 @@ async def test_async_call_read_address_variable(
1308
1308
@pytest .mark .xfail
1309
1309
@pytest .mark .asyncio
1310
1310
async def test_async_init_with_ens_name_arg (
1311
- async_w3 , async_constructor_with_address_arg_contract_instance , async_call
1311
+ async_w3 , async_constructor_with_address_arg_contract_factory , async_call
1312
1312
):
1313
1313
with contract_ens_addresses (
1314
- async_constructor_with_address_arg_contract_instance ,
1314
+ async_constructor_with_address_arg_contract_factory ,
1315
1315
[("arg-name.eth" , "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413" )],
1316
1316
):
1317
1317
address_contract = await async_deploy (
1318
1318
async_w3 ,
1319
- async_constructor_with_address_arg_contract_instance ,
1319
+ async_constructor_with_address_arg_contract_factory ,
1320
1320
args = [
1321
1321
"arg-name.eth" ,
1322
1322
],
0 commit comments