File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Original file line number Diff line number Diff line change @@ -1085,6 +1085,8 @@ def _build_and_send_tx(
1085
1085
if not tx_params :
1086
1086
tx_params = self ._get_tx_params ()
1087
1087
transaction = function .buildTransaction (tx_params )
1088
+ # Uniswap3 uses 20% margin for transactions
1089
+ transaction ["gas" ] = Wei (int (self .w3 .eth .estimate_gas (transaction ) * 1.2 ))
1088
1090
signed_txn = self .w3 .eth .account .sign_transaction (
1089
1091
transaction , private_key = self .private_key
1090
1092
)
@@ -1096,12 +1098,11 @@ def _build_and_send_tx(
1096
1098
logger .debug (f"nonce: { tx_params ['nonce' ]} " )
1097
1099
self .last_nonce = Nonce (tx_params ["nonce" ] + 1 )
1098
1100
1099
- def _get_tx_params (self , value : Wei = Wei (0 ), gas : Wei = Wei ( 250000 ) ) -> TxParams :
1101
+ def _get_tx_params (self , value : Wei = Wei (0 )) -> TxParams :
1100
1102
"""Get generic transaction parameters."""
1101
1103
return {
1102
1104
"from" : _addr_to_str (self .address ),
1103
1105
"value" : value ,
1104
- "gas" : gas ,
1105
1106
"nonce" : max (
1106
1107
self .last_nonce , self .w3 .eth .get_transaction_count (self .address )
1107
1108
),
You can’t perform that action at this time.
0 commit comments