Router contract for Swap with fee through Uniswap and PancakeSwap

I'm developing my own Swap interface that will allow users to swap all ERC20 tokens, but I'd like to create a custom Router and set a small fee, and also collect statistics for the UI.

is there something like this open source for me to take a look at?
This sample here do that, but the developer do not show the code.

1 Like

since you don't have access to this code, why not use router like that of pancakeswap, uniswap etc that is known and proven.

for two reasons...

1 - I need to charge fees on swaps, something like 0.2%
2 - with a custom router I could have all the metrics I need, like how much was swapped for my swap, how much swaps, etc...

1 Like