Timelock
Last updated
Was this helpful?
Last updated
Was this helpful?
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 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:
Time lock contract: