How to Use Farms with BscScan
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MHREX7DHcljbY5IkjgJ-1972196547%252Fuploads%252FAqdXb1HwnrSVBg6Dpg8M%252Fhow-to-yield-farms-bscscan-header.png%3Falt%3Dmedia%26token%3D5329ae36-2d4e-4dc7-aedf-85337c11cc19&width=768&dpr=4&quality=100&sign=1a056932&sv=1)
Since it requires several steps, using Farms with PancakeSwap can seem intimidating at first. This guide will walk you through using the Farms contract directly through BscScan.
Please understand that using BscScan to interact with contracts is not recommended for beginners. If you're not feeling confident, we suggest using the
instead.
Finding Farm process identifier
To interact correctly with the farming smart contract, you’ll need the matching process identifier (PID) for your LP pair. For now, the easiest way to locate this is to check GitHub.
2. Control/command + F and search for your pair by ticker (not project name). For example, 'CAKE-BUSD'.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbmNofkorR92isGZtMh%252F-MbouIhyaIRlEhCs9AjM%252Fimage.png%3Falt%3Dmedia%26token%3D50c95e71-3b4e-4f72-b618-0a33bf493f89&width=768&dpr=4&quality=100&sign=bb525004&sv=1)
3. Write down or copy the PID number—in this case 389—somewhere you can access it easily. You'll need this later.
Depositing LP Tokens through BscScan
There are a few things involved in depositing LP Tokens using BscScan. We've broken it down into steps to make it easier to follow along.
Getting the Main Staking Contract address
The address for the main staking contract is: 0x73feaa1eE314F8c655E354234017bE2193C9E24E
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbmNofkorR92isGZtMh%252F-Mbp1nXv8BY_GqBCaIhY%252Fimage.png%3Falt%3Dmedia%26token%3Dd2d5c5f1-d0f8-4a16-9d5c-670ff7054441&width=768&dpr=4&quality=100&sign=8b82bfcb&sv=1)
Open the contract for your LP Token
You'll need to approve the smart contract for the LP Token you wish to commit to a farm before you can spend it.
2. Control/command + F and search for your pair by ticker (not project name). For example, 'CAKE-BNB'
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-McgveN_06WzVRLK1FeR%252F-McgwmGUCIjvdfLKU9VR%252Fimage.png%3Falt%3Dmedia%26token%3Da8e11b39-4458-4e87-9f17-4e01ac4d192b&width=768&dpr=4&quality=100&sign=325ca649&sv=1)
3. When you have the code for the LP pair you're looking for up, find the address after "56:". This will be your contract address.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-McgveN_06WzVRLK1FeR%252F-McgxJyVDFAxh9cZhEqt%252Fimage.png%3Falt%3Dmedia%26token%3D0638fe99-b1d5-4be3-8fd7-c1b68ca59032&width=768&dpr=4&quality=100&sign=56ef6cc0&sv=1)
1. First, visit the
and search for your chosen pair using the "SEARCH" field in the top right. We're using CAKE-BUSD for this example.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbmNofkorR92isGZtMh%252F-MboxfvCzzhDYucewEJM%252Fimage.png%3Falt%3Dmedia%26token%3Da2340e87-0ac4-4db7-8868-3c021fcabe13&width=768&dpr=4&quality=100&sign=7e8b013b&sv=1)
2. Click Details to expand the row to show more information.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbmNofkorR92isGZtMh%252F-MboyRav88nxt7uoSMcm%252Fimage.png%3Falt%3Dmedia%26token%3D4368c32c-79bf-477b-8853-bdfab36b88cb&width=768&dpr=4&quality=100&sign=6eafdea0&sv=1)
3. Click View Contract to open the smart contract on BscScan.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbmNofkorR92isGZtMh%252F-Mboz8UGShU9TSD7lct4%252Fimage.png%3Falt%3Dmedia%26token%3Dd5b90a00-3fb2-4a4f-b77f-c5709b904ee5&width=768&dpr=4&quality=100&sign=ebc6adb7&sv=1)
Giving permission to the LP Token contract
Now that you have your LP Token's contract open on BscScan, you're going to approve the spending of your LP Tokens into the Farm.
1. On the LP Token's contract page, go to Contract, and then Write Contract.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbmNofkorR92isGZtMh%252F-Mbp2ObHkQgjgI-W5oHd%252Fimage.png%3Falt%3Dmedia%26token%3Dbd3301ee-86d4-4899-8256-467a591104a8&width=768&dpr=4&quality=100&sign=7704ed50&sv=1)
2. Click Connect to Web3 to connect MetaMask.
3. Under function 1, “approve”, you’ll see “spender:address”. Paste in the Main Staking Contract’s contract address you copied to clipboard earlier.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbmNofkorR92isGZtMh%252F-Mbp7nSuoGINXJV4b3rm%252Fimage.png%3Falt%3Dmedia%26token%3Da07d5f8b-df85-4df8-8c33-8c9d74f20ff3&width=768&dpr=4&quality=100&sign=df9b6db6&sv=1)
5. You’re also going to need to approve the amount of LP Tokens the contract can spend. In the value field, you’ll need to enter the amount in Wei. You can use the
to easily change your amount into Wei. Here we'll use 5 CAKE-BUSD LP Tokens.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbmNofkorR92isGZtMh%252F-Mbp7ayxZbb60iG9uHfV%252Fimage.png%3Falt%3Dmedia%26token%3D7fb50d56-32fc-4577-b96a-1ddf6ab74940&width=768&dpr=4&quality=100&sign=51238316&sv=1)
You can also use -1
as the value to give unlimited spend approval. This does not mean you will spend everything by default, but only that a transaction of any size using this contract will be allowed by your wallet.
6. Click Write and accept the action in your MetaMask wallet. You’re now able to commit LP Tokens to the Farm up to the amount you’ve approved.
Deposit LP Tokens with the Main Staking Contract smart contract
With the Main Staking Contract now approved to spend your LP Tokens, it's time to make a deposit.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbmNofkorR92isGZtMh%252F-Mbp2ObHkQgjgI-W5oHd%252Fimage.png%3Falt%3Dmedia%26token%3Dbd3301ee-86d4-4899-8256-467a591104a8&width=768&dpr=4&quality=100&sign=7704ed50&sv=1)
2. Click Connect to Web3 to connect MetaMask.
3. Scroll to function 2, "deposit", and type your PID into the "_pid" field.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbpARe5bzCMd5XORkuR%252F-Mbsxc1rAB8T2_R8rrzR%252Fimage.png%3Falt%3Dmedia%26token%3D03aeb1e2-feba-4f82-b3dc-74ff9f435a19&width=768&dpr=4&quality=100&sign=48ff6900&sv=1)
If you didn't copy down your PID earlier, you can learn how to get it in the Finding Farm process identifier section higher up this page.
4. Underneath _pid you'll see "_amount". Enter the amount for the LP contract to spend that you approved earlier.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbpARe5bzCMd5XORkuR%252F-MbsyWOLP4b1bMdQyTnA%252Fimage.png%3Falt%3Dmedia%26token%3D3cb0d014-8174-420a-ad4f-1ebd6e3619dc&width=768&dpr=4&quality=100&sign=efe818a0&sv=1)
5. Check the information and click Write. Confirm your action in MetaMask.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbpARe5bzCMd5XORkuR%252F-Mbsyp72o0h6GheA90EF%252Fimage.png%3Falt%3Dmedia%26token%3D5e6148e4-a6ec-48f0-8cba-752b3b9d499e&width=768&dpr=4&quality=100&sign=d6fc0560&sv=1)
6. You can confirm your deposit worked by clicking View your transaction.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbpARe5bzCMd5XORkuR%252F-Mbt6-zveDG6pEb5on0q%252Fimage.png%3Falt%3Dmedia%26token%3D28a9f6aa-25cf-4089-b111-f3486a3b88ad&width=768&dpr=4&quality=100&sign=4daea4f4&sv=1)
Withdrawing your LP Tokens from a Pool is very similar to making a deposit. The difference is which function you'll interact with.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbmNofkorR92isGZtMh%252F-Mbp2ObHkQgjgI-W5oHd%252Fimage.png%3Falt%3Dmedia%26token%3Dbd3301ee-86d4-4899-8256-467a591104a8&width=768&dpr=4&quality=100&sign=7704ed50&sv=1)
2. Click Connect to Web3 to connect MetaMask.
3. Scroll all the way down to function 15, "withdraw", and type your PID into the "_pid" field.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbpARe5bzCMd5XORkuR%252F-MbtAvbr6T5eY7FhtaMv%252Fimage.png%3Falt%3Dmedia%26token%3D61031f79-8b18-4a09-9153-09d4e41703a2&width=768&dpr=4&quality=100&sign=432b3f5e&sv=1)
If you didn't copy down your PID earlier, you can learn how to get it in the Finding Farm process identifier section higher up this page.
4. Underneath _pid you'll see "_amount". Enter the amount of LP you'd like to withdraw from the Pool.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbpARe5bzCMd5XORkuR%252F-MbtBD8bokfhbBDKKTpT%252Fimage.png%3Falt%3Dmedia%26token%3Db3410b45-e71b-4881-85f5-1cb3c7e8c6c9&width=768&dpr=4&quality=100&sign=3f801365&sv=1)
5. Check the information and click Write. Confirm your action in MetaMask.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbpARe5bzCMd5XORkuR%252F-Mbsyp72o0h6GheA90EF%252Fimage.png%3Falt%3Dmedia%26token%3D5e6148e4-a6ec-48f0-8cba-752b3b9d499e&width=768&dpr=4&quality=100&sign=d6fc0560&sv=1)
6. You can confirm your withdrawal worked by clicking View your transaction.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbpARe5bzCMd5XORkuR%252F-Mbt6-zveDG6pEb5on0q%252Fimage.png%3Falt%3Dmedia%26token%3D28a9f6aa-25cf-4089-b111-f3486a3b88ad&width=768&dpr=4&quality=100&sign=4daea4f4&sv=1)
Making an emergency withdrawal
Using the emergency withdraw function allows you to draw all your funds out of a pool when no other way is working.
Using the emergency withdraw function will forfeit your CAKE rewards!
The PancakeSwap team strongly suggests avoiding this function unless advised to do so officially by the PancakeSwap team, or if you are very comfortable interacting with smart contracts and understand the underlying code.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbmNofkorR92isGZtMh%252F-Mbp2ObHkQgjgI-W5oHd%252Fimage.png%3Falt%3Dmedia%26token%3Dbd3301ee-86d4-4899-8256-467a591104a8&width=768&dpr=4&quality=100&sign=7704ed50&sv=1)
2. Click Connect to Web3 to connect MetaMask.
3. Scroll down to function 4, "emergencyWithdraw", and type your PID into the "_pid" field.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbpARe5bzCMd5XORkuR%252F-MbtDrETo2rkolLkREKD%252Fimage.png%3Falt%3Dmedia%26token%3D6f0afd56-5d00-461d-bfd5-32290f83106c&width=768&dpr=4&quality=100&sign=8dec0614&sv=1)
If you didn't copy down your PID earlier, you can learn how to get it in the Finding Farm process identifier section higher up this page.
5. Check the information and click Write. Confirm your action in MetaMask.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbpARe5bzCMd5XORkuR%252F-Mbsyp72o0h6GheA90EF%252Fimage.png%3Falt%3Dmedia%26token%3D5e6148e4-a6ec-48f0-8cba-752b3b9d499e&width=768&dpr=4&quality=100&sign=d6fc0560&sv=1)
6. You can confirm your withdrawal worked by clicking View your transaction.
![](https://docs.pancakeswap.finance/~gitbook/image?url=https%3A%2F%2F1397868517-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-legacy-files%2Fo%2Fassets%252F-MHREX7DHcljbY5IkjgJ%252F-MbpARe5bzCMd5XORkuR%252F-Mbt6-zveDG6pEb5on0q%252Fimage.png%3Falt%3Dmedia%26token%3D28a9f6aa-25cf-4089-b111-f3486a3b88ad&width=768&dpr=4&quality=100&sign=4daea4f4&sv=1)
Last updated