0

On etherscan or bscscan when there is a function like SwapExactTokenForToken, the swap is sent to a router contract address and executed.

But how to get the factory associated to the Dex address?

Many time factory is on information page from the Dex but I'm searching a way to get the pair address from the factory associated to the swap Dex ...

I think this is impossible to do with code... is there a web3 command or something ?

This is possible with research on net like pancake factory is easy to find or uniswap etc ... This is possible too if we check all created contract from the author address...

But really, how to find the factory address from a transaction hash or from the Dex address, please ?

1 Answer 1

1

The factory address can be viewed from the router contract using the factory() getter function.

Using ethers:

const routerContract = new ethers.Contract(routerAddress, routerABI, provider);

const factoryAddr = await routerContract.factory();

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.