Help needed creating a farming platform like Sushiswap

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

1 Like

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

2 Likes

Hi @midas,

Welcome to the community :wave:

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

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

And for masterchef: https://github.com/sushiswap/sushiswap/blob/master/contracts/MasterChef.sol

1 Like

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

1 Like

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

1 Like

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

1 Like

Emmm, I think when you deposit, you should call

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.

1 Like

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

1 Like

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

1 Like

Yes I try here:

and here

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?

1 Like

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

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

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

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.

The code hasn't made it clearer.