@@ -537,35 +537,8 @@ def swap_erc20_tokens_tx(self, user: UserInfo, token_in: str, token_out: str, am
537537 raise ValueError (f"Invalid amount_in: { amount_in } for { token_in } " )
538538
539539 fee_tier = 500 # Assuming 0.05% pool fee
540- amount_out_min = 0 # Fetch dynamically for slippage protection
540+ amount_out_min = 1 # Fetch dynamically for slippage protection
541541 deadline = self .w3 .eth .get_block ("latest" )["timestamp" ] + 300 # 5 minutes from now
542-
543-
544-
545-
546-
547- fee_tiers = [500 , 3000 , 10000 ] # 0.05%, 0.3%, 1%
548-
549- amount_out_wei = None
550- for fee_tier in fee_tiers :
551- params = (
552- token_address [token_in .lower ()],
553- token_address [token_out .lower ()],
554- fee_tier ,
555- self .wallet_store .get_address (user ),
556- deadline ,
557- amount_in_wei ,
558- 135540 , # Minimum for estimation
559- 0
560- )
561- try :
562- amount_out_wei = universal_router .functions .exactInputSingle (params ).call ()
563- self .logger .debug (f"tiercheck - Found valid pool with fee tier { fee_tier } " , extra = {"amount_out_wei" : amount_out_wei })
564- break
565- except Exception as e :
566- self .logger .debug (f"tiercheck - Fee tier { fee_tier } failed: { str (e )} " , extra = {"params" : params })
567-
568-
569542
570543
571544 # ---- Step 0.5: calculate amount_out_min
@@ -735,6 +708,7 @@ def wrap_flr_to_wflr_tx(self, user: UserInfo, amount_in: float):
735708 def add_swap_txs_to_queue (self , user : UserInfo , from_token : str , to_token : str , amount : float ) -> str :
736709 self .reset_nonce (user )
737710
711+
738712 if from_token .lower () == "flr" :
739713 wrap_tx = self .wrap_flr_to_wflr_tx (user , amount )
740714 if (to_token .lower () == "wflr" ):
0 commit comments