We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent3cf179b commitcede174Copy full SHA for cede174
uniswap/uniswap.py
@@ -1085,6 +1085,8 @@ def _build_and_send_tx(
1085
ifnottx_params:
1086
tx_params=self._get_tx_params()
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))
1090
signed_txn=self.w3.eth.account.sign_transaction(
1091
transaction,private_key=self.private_key
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)
1100
-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:
1102
"""Get generic transaction parameters."""
1103
return {
1104
"from":_addr_to_str(self.address),
1105
"value":value,
-"gas":gas,
1106
"nonce":max(
1107
self.last_nonce,self.w3.eth.get_transaction_count(self.address)
1108
),