# Help needed creating a farming platform like Sushiswap

**URL:** <https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780>\
**Category:** Support\
**Created:** [February 13, 2021, 10:28am UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780 "2021-02-13T10:28:55Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![midas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/midas/32/4294_2.png) [@midas](https://forum.openzeppelin.com/u/midas)\
**Post date:** [February 13, 2021, 10:28am UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/1 "2021-02-13T10:28:55Z")

</div>

Hello Dear,

I found this forum on Google.

So here I am explaining the situation, I’m trying to launch my farming platform like Sushiswap, I have a community of 800 people who have followed me in various businesses and who are waiting for this platform to come out. The objective is to have more “reasonable” and not “excessive” interests in order to last on the long term.

I dont have dev for the moment and I want engage one in the future, but I’ve learn a lot from few weeks. And I have the same problem from long time:

1. I Create the Token
2. I Create the MasterChef contract
3. I Change the ownership Token to Masterchef address
4. I Create a Liquidity Pool Like “SUSHI-ETH”
5. I Modify the constants files and put the contracts address of Token + Masterchef and modify LP Address for the pools

What is wrong or missing ? because I can connect my wallet on the farming platform, I can also approve the transaction and see my LP Tokens or UNI V2, but when I want “DEPOSIT” this LP Tokens, i have an error in the execution of contract. If you can just help me for this question.

I wish you the best, Kind regards

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [February 15, 2021, 3:27am UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/2 "2021-02-15T03:27:33Z")

</div>

Hey, welcome to the community 👋  
I am not sure, so could you please paste your code at here.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [February 15, 2021, 3:30am UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/3 "2021-02-15T03:30:31Z")

</div>

Hi @midas,

Welcome to the community 👋

You may want to find a developer to partner with.

You can try posting in the forum with what you are looking for and what you are providing in return (e.g. payment).  
See some other posts as examples: [https://forum.openzeppelin.com/tag/developer-wanted](https://forum.openzeppelin.com/tag/developer-wanted)

---

<div class="post-metadata">

**Author:** ![midas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/midas/32/4294_2.png) [@midas](https://forum.openzeppelin.com/u/midas)\
**Post date:** [February 15, 2021, 11:03am UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/4 "2021-02-15T11:03:15Z")

</div>

Hey Skyge, thanks for your answer. I’m glad to be here!!

For the token I use the same of SushiToken: [https://github.com/sushiswap/sushiswap/blob/master/contracts/SushiToken.sol](https://github.com/sushiswap/sushiswap/blob/master/contracts/SushiToken.sol)

And for masterchef: [https://github.com/sushiswap/sushiswap/blob/master/contracts/MasterChef.sol](https://github.com/sushiswap/sushiswap/blob/master/contracts/MasterChef.sol)

---

<div class="post-metadata">

**Author:** ![midas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/midas/32/4294_2.png) [@midas](https://forum.openzeppelin.com/u/midas)\
**Post date:** [February 15, 2021, 11:03am UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/5 "2021-02-15T11:03:50Z")

</div>

Hi @abcoathup and thanks for your answer. I will try to find a developer for that. I appreciate It !

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [February 15, 2021, 1:56pm UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/7 "2021-02-15T13:56:39Z")

</div>

Maybe you should also call the function `add` in the `masterchief` to add LP token.

---

<div class="post-metadata">

**Author:** ![midas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/midas/32/4294_2.png) [@midas](https://forum.openzeppelin.com/u/midas)\
**Post date:** [February 15, 2021, 2:24pm UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/8 "2021-02-15T14:24:36Z")

</div>

In the Masterchief we have (see below) It’s not good ?

```
// Add a new lp to the pool. Can only be called by the owner.
// XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
function add(
    uint256 _allocPoint,
    IERC20 _lpToken,
    bool _withUpdate
) public onlyOwner {
    if (_withUpdate) {
        massUpdatePools();
    }
    uint256 lastRewardBlock =
        block.number > startBlock ? block.number : startBlock;
    totalAllocPoint = totalAllocPoint.add(_allocPoint);
    poolInfo.push(
        PoolInfo({
            lpToken: _lpToken,
            allocPoint: _allocPoint,
            lastRewardBlock: lastRewardBlock,
            accSushiPerShare: 0
        })
    );
}

```

Thank you Skyge

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [February 15, 2021, 2:29pm UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/9 "2021-02-15T14:29:27Z")

</div>

Emmm, I think when you deposit, you should call

```auto
function deposit(uint256 _pid, uint256 _amount) public {

        require (_pid != 0, 'deposit CAKE by staking');

        PoolInfo storage pool = poolInfo[_pid];

       xxx
}

```

So you need to pass a correct `_pid`, and `cakeToken` is the first token in the `poolInfo`, so when you want to deposit your own lp token, I think you should call the function `add` to add this token into the `poolInfo` at first.

---

<div class="post-metadata">

**Author:** ![midas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/midas/32/4294_2.png) [@midas](https://forum.openzeppelin.com/u/midas)\
**Post date:** [February 15, 2021, 7:33pm UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/10 "2021-02-15T19:33:02Z")

</div>

Thank you very much for all this informations. I’ve try to modify the Deposit and Withdraw by following your instructions normally. But it doesn’t work

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [February 15, 2021, 7:46pm UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/11 "2021-02-15T19:46:01Z")

</div>

Do you have a script to deploy these contracts or a test case?

---

<div class="post-metadata">

**Author:** ![midas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/midas/32/4294_2.png) [@midas](https://forum.openzeppelin.com/u/midas)\
**Post date:** [February 15, 2021, 10:20pm UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/12 "2021-02-15T22:20:47Z")

</div>

Yes I try here:

> **[Generate](https://generate.finance)**
>
> Farm SUSHI with Uniswap LP Token

and here

> **[PancakeSwap](https://laughing-sammet-b74eb5.netlify.app/)**
>
> The most popular AMM on BSC by user count! Earn CAKE through yield farming or win it in the Lottery, then stake it in Syrup Pools to earn more tokens! Initial Farm Offerings (new token launch model pioneered by PancakeSwap), NFTs, and more, on a...

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [February 15, 2021, 11:30pm UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/13 "2021-02-15T23:30:52Z")

</div>

No, I mean your operation steps.  
And do you deploy the contract manually rather than by a script?  
Or could you please paste the failed transaction hash at here?

---

<div class="post-metadata">

**Author:** ![nocturno](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@nocturno](https://forum.openzeppelin.com/u/nocturno)\
**Post date:** [February 28, 2022, 10:41pm UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/15 "2022-02-28T22:41:42Z")

</div>

what's the difference between `Masterchief.deposit(..)` and `Masterchief.add(..)`?

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [March 2, 2022, 12:55pm UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/16 "2022-03-02T12:55:35Z")

</div>

add: Add a new lp to the pool.  
deposit: Deposit LP tokens to MasterChef

---

<div class="post-metadata">

**Author:** ![nocturno](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@nocturno](https://forum.openzeppelin.com/u/nocturno)\
**Post date:** [March 2, 2022, 5:24pm UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/17 "2022-03-02T17:24:26Z")

</div>

When would I use `add()` and when would I use `deposit()`?

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [March 3, 2022, 4:59am UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/18 "2022-03-03T04:59:51Z")

</div>

I think you should call `add` at first, and then call `deposit`, and for more details, I think you can have a look at the contract code.

---

<div class="post-metadata">

**Author:** ![nocturno](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@nocturno](https://forum.openzeppelin.com/u/nocturno)\
**Post date:** [March 10, 2022, 11:29am UTC](https://forum.openzeppelin.com/t/help-needed-creating-a-farming-platform-like-sushiswap/5780/19 "2022-03-10T11:29:29Z")

</div>

The code hasn't made it clearer.
