change deployement to FavNb

This commit is contained in:
Clement 2023-08-14 15:47:13 +02:00
parent 285cca664a
commit 4e0cd86bd4

View File

@ -4,21 +4,29 @@
// You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat
// will compile your contracts, add the Hardhat Runtime Environment's members to the
// global scope, and execute the script.
import hre from "hardhat";
const currentTimestampInSeconds = Math.round(Date.now() / 1000);
const unlockTime = currentTimestampInSeconds + 60;
const FavoriteNumber = await hre.ethers.getContractFactory("FavoriteNumber");
const favoriteNumber = await FavoriteNumber.deploy();
const lockedAmount = hre.ethers.parseEther("0.001");
await favoriteNumber.deployed();
const lock = await ethers.deployContract("Lock", [unlockTime], {
value: lockedAmount,
});
console.log("FavoriteNumber deployed to:", favoriteNumber.address);
await lock.waitForDeployment();
// const currentTimestampInSeconds = Math.round(Date.now() / 1000);
// const unlockTime = currentTimestampInSeconds + 60;
console.log(
`Lock with ${ethers.formatEther(
lockedAmount
)}ETH and unlock timestamp ${unlockTime} deployed to ${lock.target}`
);
// const lockedAmount = hre.ethers.parseEther("0.001");
// const lock = await ethers.deployContract("Lock", [unlockTime], {
// value: lockedAmount,
// });
// await lock.waitForDeployment();
// console.log(
// `Lock with ${ethers.formatEther(
// lockedAmount
// )}ETH and unlock timestamp ${unlockTime} deployed to ${lock.target}`
// );