Masterchef: add function

Hi! I am still here learning about the contracts, token, masterchef and timelock.

Now I am with the masterchef trying to understand the add function:


Correct me if I am wrong, but this function is for create a pool right?

I tried execute this function once and the poolLenght change to 1 and, true when I run the query poolExistence.

But I don’t understand exactly the arguments:

  • _allocPoint: what is it? The amount of tokens that this specific pool will reward?
  • _lpToken: I assume is the address of the token pair.
  • depositFeeBP: the deposit that the pool will charge to the user?



What I like to do is perform a similar transaction via web3 (say MetaMask) and inspect the data being sent when using the protocols UI. This will give you an idea of what arguments are being used and what data is being sent (both encoded and decoded).

But I am creating a pool, using BSCScan connected through Metamask. I can’t execute the function without understand the input arguments :confused:


Is the contract you are interacting with your own or another protocols contracts (like pancakeswap)? If the latter, then you can mimick the txn on a testnet via the protocols frontend UI. For example, if you wanted to create a pool, you can create test tokens and try to then add them via there frontend UI. This will also help you see what data is being used and called via metamask and testnet explorer).

You cant execute the add function if you are not the owner. I have the contracts deployed on the testnet. How do you create the pool using the frontend? I have deployed the frontend of Pancakeswap. I used the frontend to add liquidity and get the lp address.

But I need to understand what alloc points is.

If you forked a protocol and they have documentation on there code, i’d check there. Also
a quick search of alloc_points resulted in numerous matches. Does this help? Deploying contract for farming but don't understand "_allocPoint" & "_withUpdate"

1 Like

I found that link but didn’t saw the post with the answer :sweat_smile: With that and this reddit I found, I think now understand the function:

Thanks for your time!