General steps to fork Pancake-like /

hello! I’m a newbie in blockchain but I have enough experience in developing, so it was looked easy for me to fork the whole pancakeswap site to get how it works. So, I’m trying fork pancake swap to understand how it works and I stuck on deploying phase :slight_smile:

It looks like doing something wrong in general steps.
So what I think is steps of deploying ( I deploy to bsc testnet):

  1. Deploy cake token and syrop token
  2. Deploy Factory and PancakePair contract.
  3. Make pairs for wBNB, Cake and Syrop token -there I get fail the pair with wBNB fail on mint.
  4. Deploy MasterChef
  5. add pairs from step 3 to MasterChef.
  6. Deploy SousChef.

It seems I was missing what is routing contracts do, and my steps are wrong.
Can you share with me correct steps?

Thanks!
PS:/ Sorry if it is wrong place for topic.

:1234: Code to reproduce

  await deployer.deploy(Factory, devAddress)
  await deployer.deploy(PancakePair)
  const factoryInstance = await Factory.deployed()


  const cakeTokenAddr = '0x6b7D3B400b1753d13dA077DF744C4bdd83Dde07F';
  const syropTokenAddr = '0xc736b4e2135827D950127dAfe6db7D40F5fEF354';
  const wrapedBNBAddr = '0xae13d989dac2f0debff460ac112a837c89baa7cd';

  const happyTokenInstance = await PancakeERC20.at(cakeTokenAddr);
  const syropTokenAddrInstance = await PancakeERC20.at(syropTokenAddr);
  const wrapedBNBAddrInstance = await PancakeERC20.at(wrapedBNBAddr);


  const Cake_wBNB_PAIR = await PancakePair.at((await factoryInstance.createPair(cakeTokenAddr, wrapedBNBAddr)).logs[0].args.pair);
  const Syrop_wBNB_PAIR = await PancakePair.at((await factoryInstance.createPair(syropTokenAddr, wrapedBNBAddr)).logs[0].args.pair);
  const Syrop_Cake_PAIR = await PancakePair.at((await factoryInstance.createPair(cakeTokenAddr, syropTokenAddr)).logs[0].args.pair);



  console.log(' ---- deposit  Cake_wBNB_PAIR');
  await happyTokenInstance.transfer(Cake_wBNB_PAIR.address, '70000000000000000000', { from: devAddress }); // 70 
  await syropTokenAddrInstance.transfer(Cake_wBNB_PAIR.address, '1000000000000000', { from: devAddress }); // 0.001 
  await Cake_wBNB_PAIR.mint(devAddress);  // there it fails

:computer: Environment

1 Like

Hello, I’m trying to do the same, have you got discord? Im working on defi game project

1 Like

Sorry for very different question, when deploying this to the mainnet how much does it cost?

1 Like

to Bsc? less than a cent.

Hi, I just had a quick glance, I think if you want to deploy the swap, you should deploy the Router contract at the same time.