Skip to content

Instantly share code, notes, and snippets.

@Violet-Bora-Lee
Created October 27, 2025 00:44
Show Gist options
  • Save Violet-Bora-Lee/e43bfdac3b76373a0767f7100b5cae4a to your computer and use it in GitHub Desktop.
Save Violet-Bora-Lee/e43bfdac3b76373a0767f7100b5cae4a to your computer and use it in GitHub Desktop.
하나금융-Hardhat실습
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.28;
// Import the hardhat console
import "hardhat/console.sol";
contract MyTest {
uint256 public unlockTime;
address payable public owner;
event Widthrawal(uint256 amount, uint256 when);
constructor(uint256 _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 Widthrawal(address(this).balance, block.timestamp);
owner.transfer(address(this).balance);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment