Skip to content

Commit bcec838

Browse files
Added gas property to build_transactions
1 parent 916683d commit bcec838

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/flare_ai_defai/blockchain/sparkdex.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ def swap_erc20_tokens_tx(self, user: UserInfo, token_in: str, token_out: str, am
623623
approval_tx = contract_in.functions.approve(universal_router_address, amount_in_wei).build_transaction({
624624
'from': self.wallet_store.get_address(user),
625625
'nonce': self.get_nonce(),
626+
'gas': 500000,
626627
"maxFeePerGas": 2*(base_fee + priority_fee),
627628
"maxPriorityFeePerGas": 2*(priority_fee),
628629
'chainId': self.w3.eth.chain_id,
@@ -651,6 +652,7 @@ def swap_erc20_tokens_tx(self, user: UserInfo, token_in: str, token_out: str, am
651652
swap_tx = universal_router.functions.exactInputSingle(params).build_transaction({
652653
'from': self.wallet_store.get_address(user),
653654
'nonce': self.get_nonce(),
655+
'gas': 500000,
654656
"maxFeePerGas": 10*(base_fee + priority_fee), #self.w3.eth.gas_price,
655657
"maxPriorityFeePerGas": 10*(priority_fee), #self.w3.eth.max_priority_fee,
656658
'chainId': self.w3.eth.chain_id,
@@ -698,8 +700,9 @@ def wrap_flr_to_wflr(self, amount_in: float):
698700
"from": self.address,
699701
"nonce": self.w3.eth.get_transaction_count(self.address),
700702
"value": self.w3.to_wei(amount_in, unit="ether"), # Sending FLR directly
701-
"maxFeePerGas": base_fee + priority_fee,
702-
"maxPriorityFeePerGas": priority_fee,
703+
"gas": 500000,
704+
"maxFeePerGas": 2*(base_fee + priority_fee),
705+
"maxPriorityFeePerGas": 2*priority_fee,
703706
"chainId": self.w3.eth.chain_id,
704707
"type": 2,
705708
})
@@ -751,9 +754,10 @@ def wrap_flr_to_wflr_tx(self, user: UserInfo, amount_in: float):
751754
wrap_tx = wflr_contract.functions.deposit().build_transaction({
752755
"from": self.wallet_store.get_address(user),
753756
"nonce": self.get_nonce(),
757+
"gas": 500000,
754758
"value": self.w3.to_wei(amount_in, unit="ether"), # Sending FLR directly
755-
"maxFeePerGas": base_fee + priority_fee,
756-
"maxPriorityFeePerGas": priority_fee,
759+
"maxFeePerGas": 2*(base_fee + priority_fee),
760+
"maxPriorityFeePerGas": 2*(priority_fee),
757761
"chainId": self.w3.eth.chain_id,
758762
"type": 2,
759763
})

0 commit comments

Comments
 (0)