Hey guys. I had a doubt. I am working on a Dex router frontend. And I was wondering how to decide which pairs to route through supporting fee on transfer tokens and which pairs to go through normally

Mar 18, 2023, 9:54 PM
I was thinking of running a sim to check token balances before and after and get token transfer fees. That's how it would work in a backend but I'm not sure that's the accepted practice with frontends too
I am still looking. Willing to pay as well for the work
Mar 19, 2023, 6:44 AM
First you search for direct pair. If that exists, use that. If it doesn't, search for pair with popular coins such as uadc, usdt, dai... And route through that
If multiple pairs exist, choose the one with higher liquidity and do multi hops
Mar 19, 2023, 6:53 AM
Oh selecting path isn't an issue. How do I decide between normal swap functions vs supportingFeeOnTokenTransfers
Mar 19, 2023, 6:57 AM
Trial and error. Try normal swap first, if it goes through then let it and if it doesn't, use swapsupportingfee
Mar 19, 2023, 7:15 AM
Can't do that with a frontend. There is a need to account for the fees in amount out param.

For instance the amounts out returns some x value. When I try to call swap exact tokens for tokens, I get the same value as from amounts out and no reverts. When I estimate gas, I get revert. Same with the supportingFeeOnTokenTransfers. So I need to account for the fee from token. Is there any way to do it without simulations?
Mar 19, 2023, 7:23 AM
That's why slippage exists. You adjust your amountOutDesired according to the slippage. If the transaction doesn't goes through with the adjusted amount, that means fee is greater than the provided slippage
Mar 19, 2023, 7:33 AM
Yes but I can't hit and trial until I get the exact fee of a token. I have a solution, it's to sim the tx and compare token balances afterwards. I was just wondering what the industry standard was for this
Mar 19, 2023, 7:46 AM
You don't have to. Try normal swap first, then try swap with fee once with slippage applied. If those two doesn't work, display an error. That's how existing dexes work
Mar 19, 2023, 8:53 AM
I am pretty sure they manage fee from fee tokens
Mar 19, 2023, 4:33 PM
And I'm pretty sure they don't. Have you tried trading a token with fee before? You'll first set a reasonable slippage percentage and try. If that doesn't goes through, you up the slippage and try again
Most of these shitcoin website will even tell you how much slippage to use when trading
Mar 19, 2023, 4:46 PM
How are you blockchain and token listing expert if you don't know what a testnet is
Mar 19, 2023, 6:33 PM
thanks didn't notice it
Mar 19, 2023, 6:34 PM
Good riddance
Mar 19, 2023, 6:34 PM

© 2024 Draquery.com All rights reserved.