*Paid Advertisement. Not financial advice. RugDoc is not responsible for the projects showcased here. DYOR and ape safu.

How to Emergency Withdraw (Polygon)

In this article you will learn how you can withdraw your funds by direct interaction with the MasterChef contract. This is an essential step you should be prepared for before you enter a farm, as you will not have much time when you will need it.

Step 1: Know the MasterChef address #

In order to use the emergencyWithdraw function you need to know the address of the Masterchef contract and your pool number. If you don’t know your pool ID please read this article and if you don’t know the MasterChef address yet, you can have a look here: How to find MasterChef contract

Step 2a: Use Our Brand New Emergency Withdraw Tool #

As an alternative, we have a brand new tool available for you to use that will automate the rest of this process. Please check it out here:

https://rugdoc.io/emergency/

Step 2b: Navigate to the contract #

It’s always good to learn how to do it the old fashioned way, so here’s the rest of the tutorial:

We’ll use this MasterChef contract as an example.

Navigate to the contract via Polygonscan—a blockchain explorer– then double check the contract address and select the “Write Contract” button in the “Contract” tab.

Contract in network explorer

Step 3: Connect your Wallet to the explorer #

Click on the “Connect to Web3” Link..

Connecting to web3 in explorer

..and choose your Wallet.

Connecting wallet

If you have multiple addresses in your MetaMask wallet choose the right one and click on “Next” in the MetaMask window.

Next button in MetaMask wallet

Then connect your wallet by clicking “Connect”.

Completing wallet connection in MetaMask

Maybe you have to refresh the page and click again on the “Connect to Web3” in order to get receive the connected status.

Connected to Web3

Now you are connected with the MasterChef and you can call the emergencyWithdraw function.

Step 4: Call the emergencyWithdraw function #

Within the “Write Contract” section you’ll find a section called “emergencyWithdraw”.

EmergencyWithdraw function in network explorer

Enter the pool ID (PID) of the pool you want to remove your funds from and click on “Write”. If you don’t know your pool ID please read this article. Remember to note down the pool ID in case of emergencies, as you will not have much time when you really need the emergencyWithdraw function.

Pool ID parameter of emergencyWithdraw function

Sign the transaction and you should get a confirmation that the emergency withdraw transaction was successful. If you were fast enough and the developer of the farm has not added some hard rug code in the emergency withdraw function you should now have your funds back in your wallet.

Now you know how to use the emergency withdrawal function by directly interacting with the contract. Being prepared for urgent cases is essential in order to be able to recover your funds, e.g. when the website is not accessible anymore.

If you want to find out how the emergencyWithdraw works for BSC you can read this article.

Updated on July 11, 2021
How do you feel about this article?

2 Comments

  1. Do you have any similar functions for scam contracts? In Polygon Network there is Stableone with a gas loophole which prevents withdrawals.

    0x9fd1836885e44ee084a2ae479982540b0ba48f04 <- This is scam contract.

    • Unfortunately there is no emergencyWithdraw function available in the contract. You can just use the implemented “withdraw” function, which is a custom function and maybe won’t work.

Leave a Reply to DrogowitCancel Reply

*Paid Advertisement. Not financial advice. RugDoc is not responsible for the projects showcased here. DYOR and ape safu.

EN