Making your own DEX

Hi everyone, i had this idea for a new liquidity pool design. I already have some Solidity programming experience. What i want to do is basically my own decentralized exchange (DEX), with a generic liquidity pool contract for Token/Token pairs, and then a factory contract that you can call to deploy a new liquidity pool contract whenever you want to add a new token/token pair. So basically something like a basic Uniswap, pretty much.

I started coding a simple liquidity pool contract, but i realized that maybe this is not the kind of thing that you should completely write yourself, because a security bug in something like a DEX can be catastrophic, and if you write everything on your own bugs are very likely…

So, my question is, what would be the best route to do this? Should i use some kind of template/standard? (I dont know of any, and i dont want to fork Uniswap)? Should i write everything myself?
Is my liquidity pool and factory contract a good way of doing this?
Thanks guys

1 Like

Checkout Pankcake swap. All their code is on gitlab.

I’m wanting to do something similar. I want a token pair (my token + BNB or similar) I’ll take the BNB and invest, then distribute profits via another contract, spread across all token holders according to % holding.