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 2: Navigate to the contract

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.

ใส่ความเห็น

อีเมลของคุณจะไม่แสดงให้คนอื่นเห็น ช่องข้อมูลจำเป็นถูกทำเครื่องหมาย *