Forking Masterchef, Syrupbar and Caketoken

Hello Guys! I have been searching and experimenting and trying for hours now and I cant figure out how to deploy the Caketoken, Syrupbar and Masterchef correctly. I hope someone can help me out.

I want to create my own token and to start mining it through the masterchef and syrupbar contract. Im stuck at the very end of the contract and thats "depositing the LP Token"

My Steps:

  1. Deploy CakeToken
  2. Deploy Syrupbartoken with the Caketoken address
  3. Deploy Masterchef with Caketoken, Syrupbar adress and also giving my own address as a DEV and mintin 40 tokens per block.
  4. Added a Pool which is visible on the screenshot with poolid: 1 , the Bakeryswap testnet LP and 1000 allocation points.
    The contracts above are all verified on the bsc explorer.
  5. When I try to deposit the LP token I get this error.
  6. I also tried to to transfer wonership to the masterchef contract (Caketoken and Syrupbar) but still got the same error. In this example I didnt transfer the ownership yet. But same error appears even if I set the gas fee high.

But there is something I dont understand on the masterchef contract. When someone adds an LP to the pool to lets say farm CAKE. What rlly happens there: As far as I understand: The produced LP are beeing sold and CAKE are beeing bought instead. Is this right.

Here are my contract:
Token address:
0x739c258022ee233BEB833b7aC7C747eb63721D5e

SyrupBar:
0x5f18c2f8F796d4f52eaE885533538d45ff465F6D

Masterchef:
0xb00f063757b03ED14d817A6f1F967E0059E5F9b5

Testnet Bakeryswap LP:
0xba5fb779f3d795a84cb24c5fffc2f3aa4faaa5f4

Thankful for any help!

I have something to add: I didnt change any settings on remix. Is that the problem? Because I feel like I did everything right so far?

Hi, so you mean when you try to deposit your LP, you will get the error right?

I think you maybe you can have a look at their repo, check whether they wrote some test cases for this.

And you can send the transaction even though it throws out the error.

Hello CryptoShqip,
if I understand the problem correctly you have to approve the LP Token first in order to deposit it in the MasterChef contract

I actually tried to force the transaction, but still got the error. My Question is also, where are the LP token sold for mytoken? How do I know that. Im trying to understand that but since im not a „real“ developer its hard for me to interpret every single code.

I copied the contracts 1 on 1 with small changes. There is something on the import contracts that surely do smth. I looked into that and yet I could not understand it. Kinda depressed about this, spent so many hours trying.

I read something about this, but where do I approve it? I dont see any button to approve it on the contract.

I do not find the failed transaction. So could you please show me the failed transaction hash.

in the lp token column the first box will be approved enter the Masterchef contract address in it and the amount you want to approve.

I actually want to start from 0 tokens. If I approve lets say only 100 token, then it will stop at 100 tokens and wont mint any by itself right? Or can I just type in a big number to approve.

I want to make it kinda like bitcoin. No premine just by staking lets say CAKE and earn mytoken. I dont want to manually mint and want to transfer ownership to the masterchef

Oke, I know now what u mean. I did approve the token to masterchef and syrupbar with an imaginary number (just typed in a number to approve). After that I was able to deposit the LP Toke (I also had to approve LP Token). Now I cant withdraw out of the contract. Masterchef started minting so its kinda working. But I dont see any of my tokens in the wallet nor the syruptoken. I did not verify the contract yet. is that the problem? Very thankful for your help.

I had to redeploy the contract again:
Token address:
0xcF6600dfBF7B0B19cFDa66c40e16708e445E62D6

SyrupBar:
0x8de8B9b5A44604AECAecfb3bAbab20eaCdccAe3A

Masterchef:
0xa0Caef0716Df4cC939074956633479710739c7D8

1 Like

Funny enough, I can either withdraw nor add a new pool now. this happend after i deposited LP tokens to the Masterchef.

Here is the tx hasg: 0xfa004b9192d463d4cc9762e008ca9137918fb4951ef915d75faeb19fd22ca8ac

It says im not the owner, but im sure im using the same wallet.

I also dont see any xALBA even though its minting.

1 Like

Oke, I got it working now, I had to transfer ownership to deposit and withdraw. omg its working after all these hours...

There is one left question: The Masterchef will sell the earned LP-Token to buy mytoken right? Im not clear what the masterchef contract can do.

1 Like