# Write contract Factory (Fork pancakeswap)

**URL:** <https://forum.openzeppelin.com/t/write-contract-factory-fork-pancakeswap/34166>\
**Category:** Smart Contracts\
**Created:** [January 10, 2023, 6:41pm UTC](https://forum.openzeppelin.com/t/write-contract-factory-fork-pancakeswap/34166 "2023-01-10T18:41:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jodlerx0](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jodlerx0/32/21741_2.png) [@Jodlerx0](https://forum.openzeppelin.com/u/Jodlerx0)\
**Post date:** [January 10, 2023, 6:41pm UTC](https://forum.openzeppelin.com/t/write-contract-factory-fork-pancakeswap/34166/1 "2023-01-10T18:41:52Z")

</div>

Hello guys! can someone explain to me how to setup the Factory of my dex (pancakeswap fork) to get fees for swap, I already edited FeeTo on the factory contract, but not sure if i need to create a few different pairs or how this works, any tips or any tutorial? thanks

Also I'm looking to add new pairs on farms, and charge 2% of fees, any sugestions? thanks guys

---

<div class="post-metadata">

**Author:** ![FreezyEx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/freezyex/32/5498_2.png) [@FreezyEx](https://forum.openzeppelin.com/u/FreezyEx)\
**Post date:** [January 10, 2023, 9:53pm UTC](https://forum.openzeppelin.com/t/write-contract-factory-fork-pancakeswap/34166/2 "2023-01-10T21:53:20Z")

</div>

If you already changed feeTo address then it should be ready.

---

<div class="post-metadata">

**Author:** ![Jodlerx0](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jodlerx0/32/21741_2.png) [@Jodlerx0](https://forum.openzeppelin.com/u/Jodlerx0)\
**Post date:** [January 11, 2023, 1:00pm UTC](https://forum.openzeppelin.com/t/write-contract-factory-fork-pancakeswap/34166/3 "2023-01-11T13:00:13Z")

</div>

Thanks FreezyEx!  
I been using before pancakaswap factory v2 and Router and working well, now I'm testing with my fork or pcs factory and router but when I try to swap it is telling "Insufficient liquidity fro this trade", I suppose it's because I need add liquidiy first? Liquidity is already added on pancakeswap.. I'm bit confused.. so i need add liquidity on my platfom to swap the tokens? or something else is wrong?

Contract address:  
Factory: 0x4E531D55cE1F6f4e092d0B3C6Ae3d5CD7d444d64  
Router: 0xF1Bb09517cDcfC9C8268Ff8F550F7E99291fB806

Can you have a look? thank you so much  
Thanks

---

<div class="post-metadata">

**Author:** ![FreezyEx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/freezyex/32/5498_2.png) [@FreezyEx](https://forum.openzeppelin.com/u/FreezyEx)\
**Post date:** [January 11, 2023, 1:31pm UTC](https://forum.openzeppelin.com/t/write-contract-factory-fork-pancakeswap/34166/4 "2023-01-11T13:31:18Z")

</div>

Of course you have to add liquidity on your dex.

---

<div class="post-metadata">

**Author:** ![Jodlerx0](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/jodlerx0/32/21741_2.png) [@Jodlerx0](https://forum.openzeppelin.com/u/Jodlerx0)\
**Post date:** [January 11, 2023, 2:11pm UTC](https://forum.openzeppelin.com/t/write-contract-factory-fork-pancakeswap/34166/5 "2023-01-11T14:11:39Z")

</div>

Okay Great! thanks Frezzy

last question, so i need add liquidity for any token that i want to swap on my dex?

---

<div class="post-metadata">

**Author:** ![FreezyEx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/freezyex/32/5498_2.png) [@FreezyEx](https://forum.openzeppelin.com/u/FreezyEx)\
**Post date:** [January 11, 2023, 3:09pm UTC](https://forum.openzeppelin.com/t/write-contract-factory-fork-pancakeswap/34166/6 "2023-01-11T15:09:37Z")

</div>

Exactly. A token need liquidity at least for one pair in order to be swapped.
