# Timelock

**What is a timelock?**

A timelock is a piece of code in a smart contract that can lock the functionality of an application for a certain amount of time. Timelocks are often used to support masterchef contracts. Timelocks are important because they offer high security against rug pulls.

To visualize how a timelock works, let’s use an [everyday situation](http://www.ninjadesignstudio.com/) as an example. Suppose you want to make a personal appointment with the bank to discuss your mortgage. Call the bank and plan an appointment for the following week, this way it is indicated or queued to the bank that you will visit them next week. The appointment is “executed” from the moment you enter the bank.

Timelocks work in a similar way. Normally, if developers of a scam project want to change something in the masterchef, they can do so directly. By implementing a timelock, the developer must first call a queue transaction containing the changes to the contract. Depending on how the timelock is set, let’s say a timelock period of 3 days, it takes 3 days before the modification of the contract made by the developer is executed by means of an execution transaction.

**ToastSwap Time Lock**

As of 8/11/2021 ToastSwap has integrated a timelock smart contract to the toastswap platform. The transaction hash and the time lock smart contract can be viewed down below.

Transaction: <https://bscscan.com/tx/0x8bb2438ca8057569aba4cb092f6802794f93122979b1fc522f51367173c98432%20TIME%20LOC>

Time lock contract:  <https://bscscan.com/address/0x180808f8a6bdc75a2144ca4cc70cdce92fc4a70d#code>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://toastswap.gitbook.io/toastswap/security/timelock.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
