time! Can someone save me from days of googling and ending up with no further answer? All I want to know is how to trigger Uniswap or any AMM to call this function 'swapExactTokensForTokensSupportingFeeOnTransferTokens' when user wants to sell my token via the Uniswap/Pancakeswap/Sushiswap UI. How does uniswap know that my token takes fees and then call that fee function instead of the regular one? Where do I tell it to do that in my code?? Why is this so complicated 😤😤🤬🤬
I shared your mood friend
I've asked myself this question before, too. Didn't find a solution. The workaround is to use slippage in order to still enable your tokens to be sold. Maybe it's just the case that you simply can't tell the uniswap frontend which function to call. You'd have to provide an own frontend which calls the right function (which, I understand, is not exactly what you are looking for). If you do find a solution, please please do share it...
Pancakeswap SDK repo contains router.ts. The file contains swapCallParameters function that is called by the frontend (src/hooks/useSwapCallback.ts). Depending on there is fee or not
I will if I do find a solution. 100%
Yes this hook I've looked at through Uniswap github. After digging more into the frontend of uniswap it seems the trade.type needs to equal "EXACT_INPUT". I think the reason for that is that the input will be exact on input but after recalculating the reserves/balances after fees are take the output will be different. Either way this is the other function that sets the trade type and ultimately the correct feesontransfer function: /** * Constructs an exact in trade with the given amount in and route * @param route route of the exact in trade * @param amountIn the amount being passed in */ public static exactIn(route: Route, amountIn: CurrencyAmount, chainId: ChainId): Trade { return new Trade(route, amountIn, TradeType.EXACT_INPUT, chainId) }
Обсуждают сегодня