cover-img

What are Time-Locked Smart Contracts? - Web3 Oversimplified

Creating time sensitive smart contracts

23 September, 2022

8

8

2

Contributors

Introduction

If you're reading this, you may have heard about Time-Lock smart contracts or interacted with a dApp that has time locking capabilities.
A Time-Locked smart contract is a program that sits on a blockchain and is programmed to execute at a particular time or time frame.
Time-Locked contracts usually have a time limit or a time frame that has been set inside the contract, which makes it possible to delay the execution until a time limit is met.

Syntax

In this article, we will be using solidity to create a sample working time-locked smart contract.
The code sample above describes how to create a simple Time-Locked smart contract. But obviously, there is more to Time-locked smart contracts than just this.

Use Cases

There are quite a few use cases for Time-Locked smart contracts. A few notable include:

Investments: You can lock up funds for a specified amount of time so that no one can withdraw the funds until the end of the investment period.

Scheduled Payments: You can break down payments into schedules and settle parties when the scheduled time has arrived.

Service Delivery: You can lock up funds just for the sake of service delivery. For example, you can implement a 30-day money-back guarantee using a Time-Locked functionality.
Let's take a look at the same NFT smart contract code that has a Time-Locked functionality.
The NFT smart contract above has a mintNFT function that lets a user mint and NFT from Showwcase. However, this same contract has another function that lets the user get a refund only if the user has not held the NFT for a period of 30 days.
Lastly, the contract also prevents the contract owner from withdrawing funds for a period of 30 days. This makes the system trustless and creates transparency between the buyer and the seller of the NFT.

Conclusion

Thanks for reading!
I hope that the explanation above will guide you to writing fantastic smart contracts with Time-Locked functionality!

blockchain

web3

smart contracts

solidity

8

8

2

blockchain

web3

smart contracts

solidity

Favour
Open Sourcerer | Software Developer | Content Creator | Technical Writer | I am on a journey to make Web3 accessible to everyone 💛

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2024. Showcase Creators Inc. All rights reserved.