mirror of
https://github.com/3lLobo/zkAuth.git
synced 2026-01-10 04:47:56 -05:00
35 lines
959 B
TypeScript
35 lines
959 B
TypeScript
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 and unlock timestamp ${unlockTime} deployed to ${lock.address}`
|
|
)
|
|
testTotp()
|
|
}
|
|
|
|
async function testTotp() {
|
|
const Totp = await ethers.getContractFactory('TotpAuthenticator')
|
|
const totp = await Totp.deploy()
|
|
|
|
await totp.deployed()
|
|
|
|
console.log(`Totp successfully deployed to ${totp.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
|
|
})
|