Simply put, a timelock is an additional piece of code that restricts a certain functionality within a smart contract to a certain time window. A timelock is therefore a function that is implemented in smart contracts to enable better and more secure management of these smart contracts. Technically speaking, a timelock is a smart contract that delays function calls of another smart contract after a predetermined amount of time has passed. For example, users can queue up a function call and have it executed at a later time (after the delay time has expired). Timelocks can be useful thanks to their schedule-and-execute functionality, as they allow operations to be executed asynchronously. There are quite a number of use cases for timelock contracts. Sometimes, timelock functions are used in the context of Initial Coin Offerings (ICOs) to support the sale of tokens by the crowd. Another use case is the implementation of a lock schedule, which can be used to define the period of time during which users cannot withdraw their funds. These are just a few examples, but the possibilities of this function are almost limitless.

A simple and illustrative code snippet that implements a timelock: 


// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.18;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

contract ExampleTimelock {

    error ErrorNotReady(uint256 blockTimestmap, uint256 timestamp);


    function execute(address to, uint256 amount, uint256 timestamp) external onlyOwner {


        if (block.timestamp < timestamp) {

            revert ErrorNotReady(block.timestamp, timestamp);





How can we help? Leave us your contact and we will be happy to approach you!