# Lock contract

By [tonythanh2012](https://paragraph.com/@tonythanh) · 2023-04-07

---

![](https://storage.googleapis.com/papyrus_images/526ea6b30f2da020931ab4ae03420b433edf5197eaca83270e9aabb4671f18e4.png)

    Nhớ thêm 1696118400 vào 
    

// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; contract Lock { uint public unlockTime; address payable public owner; event Withdrawal(uint amount, uint when); constructor(uint \_unlockTime) payable { require( block.timestamp < \_unlockTime, "Unlock time should be in the future" ); unlockTime = \_unlockTime; owner = payable(msg.sender); } function withdraw() public { require(block.timestamp >= unlockTime, "You can't withdraw yet"); require(msg.sender == owner, "You aren't the owner"); emit Withdrawal(address(this).balance, block.timestamp); owner.transfer(address(this).balance); } }

---

*Originally published on [tonythanh2012](https://paragraph.com/@tonythanh/lock-contract)*
