Created
July 22, 2022 16:13
-
-
Save Zfinix/e55cdab3e3e41d9c1461f50966f9d398 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ethers } from "hardhat"; | |
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; | |
const lockedAmount = ethers.utils.parseEther("1"); | |
const Lock = await ethers.getContractFactory("Lock"); | |
const lock = await Lock.deploy(unlockTime, { value: lockedAmount }); | |
await lock.deployed(); | |
console.log("Lock with 1 ETH deployed to:", lock.address); | |
} | |
// We recommend this pattern to be able to use async/await everywhere | |
// and properly handle errors. | |
main().catch((error) => { | |
console.error(error); | |
process.exitCode = 1; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment