25
25
else :
26
26
UNISWAP_VERSIONS = [1 , 2 , 3 ]
27
27
28
+ RECEIPT_TIMEOUT = 5
29
+
28
30
29
31
@dataclass
30
32
class GanacheInstance :
@@ -54,12 +56,12 @@ def test_assets(client: Uniswap):
54
56
logger .info ("Buying..." )
55
57
56
58
tx = client .make_trade_output (tokens ["ETH" ], token_addr , amount )
57
- client .w3 .eth .wait_for_transaction_receipt (tx )
59
+ client .w3 .eth .wait_for_transaction_receipt (tx , timeout = RECEIPT_TIMEOUT )
58
60
59
61
60
62
@pytest .fixture (scope = "module" )
61
63
def web3 (ganache : GanacheInstance ):
62
- w3 = Web3 (Web3 .HTTPProvider (ganache .provider , request_kwargs = {"timeout" : 60 }))
64
+ w3 = Web3 (Web3 .HTTPProvider (ganache .provider , request_kwargs = {"timeout" : 30 }))
63
65
if 1 != int (w3 .net .version ):
64
66
raise Exception ("PROVIDER was not a mainnet provider, which the tests require" )
65
67
return w3
@@ -219,7 +221,7 @@ def get_exchange_rate(
219
221
)
220
222
def test_add_liquidity (self , client : Uniswap , web3 : Web3 , token , max_eth ):
221
223
r = client .add_liquidity (token , max_eth )
222
- tx = web3 .eth .wait_for_transaction_receipt (r , timeout = 6000 )
224
+ tx = web3 .eth .wait_for_transaction_receipt (r , timeout = RECEIPT_TIMEOUT )
223
225
assert tx ["status" ]
224
226
225
227
@pytest .mark .skip
@@ -274,7 +276,7 @@ def test_make_trade(
274
276
bal_in_before = client .get_token_balance (input_token )
275
277
276
278
txid = client .make_trade (input_token , output_token , qty , recipient )
277
- tx = web3 .eth .wait_for_transaction_receipt (txid )
279
+ tx = web3 .eth .wait_for_transaction_receipt (txid , timeout = RECEIPT_TIMEOUT )
278
280
assert tx ["status" ]
279
281
280
282
# TODO: Checks for ETH, taking gas into account
@@ -324,7 +326,7 @@ def test_make_trade_output(
324
326
balance_before = client .get_token_balance (output_token )
325
327
326
328
r = client .make_trade_output (input_token , output_token , qty , recipient )
327
- tx = web3 .eth .wait_for_transaction_receipt (r , timeout = 30 )
329
+ tx = web3 .eth .wait_for_transaction_receipt (r , timeout = RECEIPT_TIMEOUT )
328
330
assert tx ["status" ]
329
331
330
332
# TODO: Checks for ETH, taking gas into account
0 commit comments