Skip to content

Instantly share code, notes, and snippets.

@Violet-Bora-Lee
Last active October 27, 2025 01:12
Show Gist options
  • Save Violet-Bora-Lee/1c3b0d2d125f3c43ea175fc067b4e9bf to your computer and use it in GitHub Desktop.
Save Violet-Bora-Lee/1c3b0d2d125f3c43ea175fc067b4e9bf to your computer and use it in GitHub Desktop.
하나금융-Hardhat실습
// npx hardhat run scripts/deploy.js 로 스크립트 실행
// hre stands for Hardhat Runtime Environment
const hre = require("hardhat");
// console.log(hre);
async function main() {
const currentTimestampInSeconds = Math.round(Date.now() / 1000);
const ONE_YEAR_IN_SECS = 365 * 24 * 60 * 60;
const unlockTime = currentTimestampInSeconds + ONE_YEAR_IN_SECS;
// console.log("currentTimestampInSeconds:", currentTimestampInSeconds);
// console.log("unlockTime:", unlockTime);
// console.log("unlockTime (date):", new Date(unlockTime * 1000));
const lockedAmount = await hre.ethers.parseEther("1");
// console.log("lockedAmount:", lockedAmount.toString());
const MyTest = await hre.ethers.getContractFactory("MyTest");
const myTest = await MyTest.deploy(unlockTime, { value: lockedAmount });
await myTest.waitForDeployment();
console.log(`Contract contains 1 ETH & address: ${myTest.target}`);
// console.log("myTest:", myTest);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment