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

Everything You Wanted To Know About Timelocks For Yield Farming

Join any discussion room in DeFi and you’re likely to see someone talking about Timelocks. Despite how often it comes up, it’s actually quite shocking to see how wrong most people are about it. So we here at RugDoc, we decided to clear things up once and for all.

Background Info #

Examples are good for explaining complex topics… so to appeal to the common ape, we’ll use one here.

Think of a Masterchef smart contract as a bank vault that stores all the funds farmers deposit into it. If a project has $2 million worth of funds in the Masterchef, we want to make sure it’s safe from theft.

The #1 risk when yield farming is suffering a Hard Rug. Migrators, proxies, and other hard rug vectors allow the theft of 100% of ALL funds. It’s the equivalent of the owner of the bank vault forcing you to give them a spare key so they could access your deposit anytime. With this policy, all you can do is hope the owner isn’t a bad person who will use that key to steal everyone’s funds.

Now that this is clear, we can get into the details of what a Timelock does and why you should or shouldn’t care about it.

What Exactly is a Timelock and Why Should You Care? #

If a Masterchef contract has a proxy or migrator, the owner could waltz into the vault at any time and steal EVERYTHING immediately. The bank vault protects the funds inside from theft from outsiders, but the owner has the key to the door. And since he forced you to give a spare key to your safety deposit box to him, he can now steal everything inside that too.

To prevent this from happening, we create a box in the bank lobby for the owner to put his bank vault key in. We’ll call this box a Timelock.

This box is special in that it has a configurable timer on it. Once the owner puts the key in and shuts it, the box locks itself. If the owner wants the key inside, he has to start the timer, and the box unlocks only once the timer runs out. This gives a malicious owner less power. Even though he has a spare copy of your safety deposit box key, he can’t get into the vault without the main vault key.

Transactions that are queued in a timelock are usually intended to update a variable and/or call a function that already exists in the Masterchef smart contract. These contracts are immutable and the functions within cannot be changed, only how they are called.

The Truth About Timelocks #

There’s only 1 scenario where a Timelock is useful. It is ONLY useful if the owner has elevated privileges that could allow him to steal your funds at any time. Without a copy of your key, the owner’s ability to access the vault at any time with his bank vault key doesn’t matter.

That’s right — the truth is: Timelocks don’t matter if the project is already at low risk for hard rugs. They only help guard against scummy owners who say they need access to your funds at all times. If the only thing protecting you from financial ruin is a Timelock, you’re likely to end up getting rekt.

That’s because Timelocks aren’t a perfect protection scheme.

For example, the owner could make a copy of the Master Vault Key before “depositing” it into the Timelock. While everyone else is looking at the Timelock in the lobby, he can sneak to the back and steal everything. This would be like when a smart contract hides the ability for the dev role to ALSO be able to execute actions.

Or the owner could also set the timer for the Timelock to be super short. If the timer is only 6 hours, the owner could start the timer at night and flee with your funds before you wake up.

So if you lack the resources to act upon a Timelock for 24 hours a day, it’s useless to you.

When Timelocks Are Detrimental #

If our Bank Vault Owner is a good guy and doesn’t have our keys, forcing him to Timelock can be bad.

For example, if there is a fire that’s detected in the vault, nobody including him can get inside to put it out for 12 hours. In those 12 hours, the fire could destroy everything in the safe.

In this scenario, the Timelock kills the project, since it locks a timely resolution out. This is why we don’t force projects to have a Timelock that don’t have malicious code. If the owner can’t steal your stuff either way, you’d rather them have access to fix issues quickly as needed.

Conclusion #

TL;DR — In summary, here’s what we learned:

  1. Timelocks aren’t important for most projects, unless they’re shady to begin with.
  2. Chances are you don’t have the resources to act on a malicious Timelock event 24/7
  3. If a project needs a Timelock to prevent the theft of 100% of all funds… just walk away. There’s a million other projects that aren’t shady.

Develop a habit to ALWAYS check a project at RugDoc before you ape in.

It’s 100% free and we will ALWAYS highlight projects that can steal ALL funds from users.

If you want more information on how to verify a Timelock is properly set up, see our Wiki article on it here:

Updated on June 26, 2021
How do you feel about this article?
 

Leave a Reply

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

Our mission here at RugDoc is to screen for hard rug code that results in 100% theft of ALL underlying funds for ALL participants.

This is the ONE part of the due diligence process that most people cannot simply do on their own as it costs thousands of dollars to hire a senior solidity developer to look over a farm for safety.

A project coin with terrible code can go up in price, and a project with good code and a good team can also go down in price.

Do NOT use our ratings to refer to your likelihood in making money if you invest in the project. They are ONLY in reference to code safety.

Everything else beyond code safety is YOUR responsibility to go do research on. We just make sure the casino you’re betting in won’t rob you before you even get to place a bet.

Our reviews for projects are organized into a few colors.

🟢 Least Risk
These projects are the least likely to hard or soft rug. Usually reserved for cornerstone projects of an ecosystem where it makes no financial sense for them to rug in any manner as they make more money just being legit.

🔵 Low Risk
These projects are usually established projects in an ecosystem that have a track record of success or have KYC’d to us or other authoritative sources in the real world. As a result, it is extremely unlikely for them to soft rug or hard rug their projects. The projects can still fail and the token price can go down, but usually more as a result of natural market forces.

⚪️ Some Risk
This is the default rating for projects with unknown teams but have code that is unlikely to have hard rug risk. Since the team is unknown and doesn’t have a track record of success, it’s entirely possible that they may try to soft rug by dumping tokens, abandoning the project, etc. Even a last minute contract swap to a malicious contract is possible. The only thing that is unlikely is a complete hard rug as long as you are 100% sure you deposit into the contract we review.

🟠 Medium Risk
Similar to Some Risk, but the underlying code itself is custom enough or complex enough that it warrants an elevated risk rating that needs deeper research. Make sure you read every point presented to make sure you’re comfortable with that before entering. Still unlikely to hard rug, but more chances of custom code behaving incorrectly and causing other issues.

🔴 High Risk
Project contains code or practices that are HIGHLY LIKELY to lead to catastrophic losses as they are right now. Make sure you read the description carefully as we will always warn what these issues are. If you see the words Hard Rug anywhere in the review, STAY FAR AWAY!

⚫️ Not Eligible
We reserve the right to not review exceedingly complex projects that would require tens of thousands of dollars of senior security analyst man hours. Typically these are projects that deal with leverage, lending, options, derivatives, and anything that is overly complex and which requires tons of peer reviews and audits from top audit companies.

Search

🟢 For owners who have made impactful changes and would like an update to their farm review:

1️⃣ Use #update at @RugDocChat with your description and proof of changes and it will be forwarded to our scanners.

2️⃣ This does not guarantee a change in your review.

3️⃣ Owners who have difficulty solving the issues can consider our Consultation Package - please contact @BaymaxCrypto on Telegram to discuss.