PancakeSwap
Launch App
English
English
  • Welcome to PancakeSwap
    • Product Overview
    • ✨How-to Guides
      • Get Started (BSC)
        • Create a Wallet
        • Get BEP20 Tokens
        • Using PancakeSwap without Centralized Exchanges
        • Connect Your Wallet to PancakeSwap
      • Get Started (Aptos)
        • Create a Wallet
        • Get Aptos Coins
        • CAKE Bridging Guide
        • Connect Your Wallet to PancakeSwap
        • Aptos FAQ
      • V3/V2 Migration
        • How to migrate
        • How v3 APR is calculated
        • FAQ
        • V2 Migration
          • Migrate Your Stakings
          • MasterChef v2
            • List of Farms
          • CAKE Syrup Pool
    • 🗺️Roadmap
    • veCAKE Sunset
      • Staked Cake Redemption
      • 🔷[Archive] veCAKE
        • What is veCAKE?
        • How to get veCAKE?
        • Migrate from CAKE Pool
        • veCAKE Managers
        • Bridge your veCAKE
        • Earn CAKE Weekly
          • FAQ
    • 📈Analytics (Info Page)
    • ✅Audits
    • 🤙Contact Us
      • Social Accounts
      • Telegram & Discord Communities
      • 💼Business Partnerships
        • ⛽veCAKE / Gauges
        • 🧑‍🌾Initial Farm Offerings - IFOs
        • 🥞Syrup Pools and Farms
        • 🖼️NFT Marketplace
        • ❓Commonly Asked Business Partnerships Questions
      • Ambassador Program
        • What can you do as an Ambassador?
        • Benefits of a PancakeSwap Ambassador
        • Want to be an Ambassador?
        • ❓ FAQs Page
      • General FAQ
        • I need help
        • Troubleshooting Errors
        • What is an Approval Transaction?
        • Fixing Stuck Pending Transactions on MetaMask
    • 👨‍👨‍👦About Us
      • Team
        • The Kitchen Team
        • Become a Chef
          • Brand / Graphics Designer
          • Motion / Interaction Designer
          • Social Media & Content Manager
          • Developer Relations Manager
          • Product Designer (UX/I)
          • Business Development Manager
          • Senior Backend Engineer
      • Brand & Logos
  • 👴Archive
    • 📂Legacy Products
      • 🖼️[Archived] NFT Marketplace
      • 🎮[Archived] Gaming Platform
        • 📒Brand Kit
        • 🎓Pancake Mayor
        • 🛡️Pancake Protectors
          • FAQ
      • 🍯[Archived] Pottery
        • How to Play Pottery
        • Pottery FAQ
      • 🧈[Archived] Trading Reward
        • How to Participate
          • Top Traders Campaign
          • CAKE Stakers Campaign
        • FAQ
      • 🤝[Archived] Simple Staking
        • How to start Simple Staking
        • FAQ
        • Terms & Conditions
      • 🎯[Archived] PancakeSwap Quest
        • Getting Started
        • How to Join and Complete a Quest
        • Rewards
      • 💧[Archived] Liquid Staking Integration
        • How To Liquid Stake
        • WBETH
          • WBETH FAQ
        • SnBNB
          • SnBNB FAQ
      • 💸[Archived] Options
        • Options Primer
        • CLAMM Options
        • Options FAQ
      • [Archived] CAKE Syrup Pool
        • How to use the Flexible Staking option
        • How to use the Fixed-Term Staking option
    • Old Tokenomics
      • CAKE Tokenomics v1
      • Controlling CAKE supply v1
    • How to Use Farms with BscScan
    • [Archived] Affiliate Program
      • Dashboard & Link
      • Commission Structure and Payment
      • Program Rules & Guidelines
      • Terms & Conditions
  • Trade
    • 🔄Swap
      • Token Swaps
      • How to Trade
      • Fees and Routes
      • Market Maker Integration
      • Smart Router (V2)
        • How to trade using Smart Router
    • ♾️PancakeSwap Infinity
      • Key Features
      • Hooks
        • Dynamic Fee Hook
      • Pool Types
      • Farms
    • 🎯Limit Orders and Twap
      • How to use Limit Orders
      • How to use TWAP
    • 📈Perpetual Trading
      • What is Perpetual Trading?
      • Perpetual Trading V2
        • How can I use it?
        • Dumb Mode
          • Dumb Mode Guide
        • Degen Mode
          • Degen Mode Dynamic Fee
        • MADBTCUSD
          • MADBTCUSD FAQ
        • Perpetuals V2 Glossary
        • Forex
        • Perpetual Trading FAQ
          • Arbitrum
            • ALP Syrup Pool (Arbitrum)
              • ALP Buying & Selling Fees
        • Trading Rewards Program
          • Arbitrum
        • Supported Chains, Modes & Markets
      • Perpetual Trading V1
        • Perpetuals V1 Glossary
        • How can I use it?
        • V1 Perpetual Trading FAQ
    • 🏦Stableswap
      • How to StableSwap
    • 💳Buy Crypto
    • ❓Trading FAQ
      • Swap FAQ
      • v4 FAQ
      • Limit Orders and TWAP FAQ
  • Bridge
    • 🌉Bridging
      • Between EVMs
      • Between EVM and Aptos
      • Wormhole Bridge Guide
    • ❓Bridging FAQ
      • Wormhole Bridge FAQ
  • Earn
    • 🌊Liquidity Pools
      • How to Add/Remove Liquidity
      • ⛏️Pancake Picks
      • Zap
        • Zap (V2)
    • 🚜Yield Farming
      • How to Use Farms
        • How to Use Farms (Legacy)
      • APR/ROI/IL Calculator
      • Farming on Aptos
        • FAQ
      • Crosschain Farming
        • FAQ
    • 🥩Cake Staking
      • 🍯Syrup Pools - Stake CAKE
        • Syrup Pools
    • 🛍️IFO (Initial Farm Offering)
      • How to Participate in an IFO
      • How to Participate in CrossChain IFOs
      • FAQ
      • NFT Profile System
        • How to Set Up an NFT Profile
        • Teams
      • Contract Details
    • ❓Earn FAQ
      • Cake Staking FAQ
        • Syrup Pool FAQ & Troubleshooting
  • Play
    • 🔮Prediction
      • How to Use Prediction
      • AI Prediction
      • Prediction FAQ
      • Prediction Troubleshooting
      • Prediction Mini App
    • 🎟️Lottery
      • How to Play Lottery
      • Lottery FAQ
  • ❓Play FAQ
  • Trading Tools
    • 🛡️PancakeSwap MEV Guard
    • PancakeSwap Auto Slippage
      • How to Set Slippage on PancakeSwap
    • 🔔Notifications
    • ❓Trading Tools FAQ
      • MEV Guard FAQ
  • Protocol
    • 🍰CAKE Tokenomics
    • 📔Governance
      • How to Vote
    • 💻Developers
      • Developer Docs
      • Contributing
        • Codebase Overview
Powered by GitBook
On this page
  • Finding Farm process identifier
  • Depositing LP Tokens through BscScan
  • Getting the Main Staking Contract address
  • Open the contract for your LP Token
  • From the source code
  • From the UI
  • Giving permission to the LP Token contract
  • Deposit LP Tokens with the Main Staking Contract smart contract
  • Withdrawing from a Pool
  • Making an emergency withdrawal

Was this helpful?

  1. Archive

How to Use Farms with BscScan

PreviousControlling CAKE supply v1Next[Archived] Affiliate Program

Last updated 3 years ago

Was this helpful?

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'.

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

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.

From the source code

2. Control/command + F and search for your pair by ticker (not project name). For example, 'CAKE-BNB'

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.

From the UI

2. Click Details to expand the row to show more information.

3. Click View Contract to open the smart contract on BscScan.

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.

2. Click Connect to Web3 to connect MetaMask.

Confirm the connection.

3. Under function 1, “approve”, you’ll see “spender:address”. Paste in the Main Staking Contract’s contract address you copied to clipboard earlier.

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.

2. Click Connect to Web3 to connect MetaMask.

3. Scroll to function 2, "deposit", and type your PID into the "_pid" field.

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.

5. Check the information and click Write. Confirm your action in MetaMask.

6. You can confirm your deposit worked by clicking View your transaction.

Withdrawing from a Pool

Withdrawing your LP Tokens from a Pool is very similar to making a deposit. The difference is which function you'll interact with.

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.

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.

5. Check the information and click Write. Confirm your action in MetaMask.

6. You can confirm your withdrawal worked by clicking View your transaction.

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.

2. Click Connect to Web3 to connect MetaMask.

‌3. Scroll down to function 4, "emergencyWithdraw", and type your PID into the "_pid" field.

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.

6. You can confirm your withdrawal worked by clicking View your transaction.

1. Open the .

But assuming you'd like to confirm that, visit the . You'll see the address in the top-left. Click the pages icon to copy this to clipboard. You'll need it soon.

1. First, open .

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.

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.

1. Back on the , go to Contract, and then Write Contract.

1. Back on the , go to Contract, and then Write Contract.

‌1. On the , go to Contract, and then Write Contract.

👴
PancakeSwap website’s Farms code on GitHub
PancakeSwap: Main Staking Contract BscScan page
farms.ts on GitHub
PancakeSwap Farms page
BscScan Unit Converter
PancakeSwap: Main Staking Contract BscScan page
PancakeSwap: Main Staking Contract BscScan page
PancakeSwap: Main Staking Contract BscScan page
How to Use Farms guide