0

On Pancakeswap it uses multihop functionality when swapping a pair with no direct swap path. The v2 router does not support multihop and was wondering how PCS has this implemented?

As an example on this transaction

https://bscscan.com/tx/0x5ab5b9997f29c0b26c32573b4f0b10e7410bcb5e4e371cad6ce2d5c6fd49aa77

Only the last swap WBNB->DFI goes through the PCS V2 router contract. Wonder how the rest is implemented then?

1 Answer 1

0

Firstly, any contract can make a series of swap..() calls directly to PCS pairs and a final call to the router.

In this case, I'm not sure what makes you say that "only" the last step goes through the PCS V2 router contract. At the link you provided, click the "Click to see more" link under the "BNB Price" row; then, click "decode input data".

2   path    address[]   0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56
                        0x23396cF899Ca06c4472205fC903bDB4de249D6fC
                        0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c
                        0x361C60b7c2828fCAb80988d00D1D542c83387b50

There you can see that the router "swapExactTokensForTokens" call was given a path of multiple tokens to swap.

I think what you may be asking about is that the router contract receives the proceeds of the swap path, and then transfers those from itself to the destination/original-sender (0xafd...).

1
  • that is interesting. I was not aware that swapExactTokensForTokens can do multihop swaps.
    – Chris
    May 16, 2022 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.