In this article we will show you how to emergency withdraw your crypto assets by interacting directly with the MasterChef contract of a decentralized finance farm protocol on the Avalanche network.
Step 1: Get the MasterChef contract address #
In order to emergency withdraw your funds, you first need to get your hands on the MasterChef contract address and the pool number in which your assets are deployed. To find out which pool number corresponds with the liquidity pool that contains your assets, you should read this article. By following the steps in this article, you can find the MasterChef contract address.
Step 2a: Use Rugdoc’s emergency withdraw tool #
As an alternative for the steps below, we have created a tool that emergency withdraws your crypto assets in a few seconds! Please check it out here: https://rugdoc.io/emergency/
Step 2b: Search for the MasterChef contract #
In this guide, we’ll use FrostFinance’s MasterChef contract address as an example.
Open https://cchain.explorer.avax.network/ and fill in the MasterChef contract address in the top right and hit enter. Then, click on the ‘Write Contract’ tab on the right side of the screen.
Step 3: Connect your Wallet to the Avax explorer #
In order to connect your wallet tot he Avax explorer, click on the “Connect to Metamask” button.
If you have multiple addresses in your MetaMask wallet choose the right one and click on “Next” in the MetaMask window.
Then connect your wallet by clicking “Connect”.
Great! 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”.
Now it’s time to enter the pool ID (PID) of the liquidity pool you want to withdraw your assets from. Again, if you don’t know your pool ID please read this article. Please make sure to note down the pool ID in case of an emergency, due to fact that nailing down the PID can be quite tedious.
After filling in the pool ID, click on the ‘Write’ button. After signing the transaction you should get a confirmation that the emergency withdraw transaction has been successfully executed.
Great job! You have now succesfully (emergency) withdrawn your crypto assets from the liquidity pool via the Avalanche block explorer! Now that you know how to withdraw your assets directly from a liquidity pool, you might be able to immediately receive your assets once you notice a rug pull is about to take place.