How To: Use Diffcheck to Check a New Farm’s MasterChef Contract

RugDoc
3 min readMay 13, 2021

Putting your precious funds into a new yield farm can be very risky, but we can make it a bit safer by checking the MasterChef contract against that of previous, proven farms to check for malicious or otherwise dangerous code.

Can’t read Solidity? That’s OK: usually there is very little difference between the farms and in many cases a quick diffcheck can clear the new MasterChef as not containing obviously malicious code.

Step 1: Locate the MasterChef and copy it into DiffCheck.

GarudaSwap lists its MasterChef in the docs under “no Migrator code”

Most farms list the address of their MasterChef in the docs page linked from their site.

We’ll use GarudaSwap as an example in the following steps.

GarudaSwap’s MasterChef on BscScan. “Copy” button second from the right.

Make sure it is verified on bscscan.com (don’t take it from GitHub as it may not match the deployed contract) and copy it from there.

MasterChef pasted into DiffChecker. This one closely resembles the PantherSwap MasterChef

Paste the new ‘chef into one of the columns on Diffchecker. Look at the bottom part of the ‘chef code to identify which parent code the new ‘chef is forked from.

Step 2: Find the MasterChef it has been forked from.

https://trello.com/c/saSmofYj

The endings of the commonly forked Masterchef’s can be found in our Trello.

If it is none of these you have a custom code - try bringing it to the attention of the admins in RugSteemer Telegram.

Step 3: Copy the forked MasterChef from our Trello into DiffCheck

You can find the repository of commonly forked MasterChefs in our Trello.

Here’s PantherSwap.

There’s additional info on the back of the card.

PantherSwap MasterChef on BscScan

As before, grab the verified contract from BscScan.

In the empty DiffCheck column, copy and paste the parent fork MasterChef contract code.

And hit the “Find Difference” button.

Differences will be highlighted in the browser.

Step 4: Compare the two for differences

Compare your codes. Where you see differences pay attention and figure out what those differences do.

Step 5: Where differences are found, check against our list of known malicious code

Exploits and Rug Codes list

See the list “Exploits and Rug Codes” in our Trello.

Well done for reading to the end! Now you know how to (pretty quickly) evaluate a MasterChef for safety, even with little to no knowledge of the Solidity programming language.

Please stay #SAFU and #DYOR. Follow us on Twitter for regular updates of checked farms and other helpful yield-farming safety content and join us on Telegram to get more involved — if you can check farms we want to hear from you!

--

--

RugDoc

The RugDoc team is here to check yield-farms and help you avoid rugs before they can steal your funds. bit.ly/JoinRugSteemer Sheet: http://bit.ly/3vVmeXw