Skip to content
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

Update Lock.sol #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions contracts/Lock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,22 @@ contract Lock {

owner.transfer(address(this).balance);
}

modifier onlyOwner {
require(msg.sender == owner, "You are not the owner");
_;
}

event LockUpdated(uint newUnlockTime, address indexed updatedBy);
}

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);

(bool success, ) = owner.call{value: address(this).balance}("");
require(success, "Transfer failed");
}
}