|
1 |
| -// We require the Hardhat Runtime Environment explicitly here. This is optional |
2 |
| -// but useful for running the script in a standalone fashion through `node <script>`. |
3 |
| -// |
4 |
| -// You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat |
5 |
| -// will compile your contracts, add the Hardhat Runtime Environment's members to the |
6 |
| -// global scope, and execute the script. |
7 |
| -const hre = require('hardhat'); |
| 1 | +const { ethers } = require('hardhat'); |
| 2 | + |
| 3 | +// Load env variables |
| 4 | +require('dotenv').config(); |
8 | 5 |
|
9 | 6 | async function main() {
|
10 |
| - const currentTimestampInSeconds = Math.round(Date.now() / 1000); |
11 |
| - const unlockTime = currentTimestampInSeconds + 60; |
| 7 | + const deployerAddress = process.env.HARDHAT_KLAYTN_ACCOUNT_ADDRESS; |
| 8 | + const deployer = await ethers.getSigner(deployerAddress); |
12 | 9 |
|
13 |
| - const lockedAmount = hre.ethers.parseEther('0.001'); |
| 10 | + console.log(`Deploying contracts with the account: ${deployer.address}`); |
| 11 | + console.log(`Account balance: ${(await deployer.provider.getBalance(deployerAddress)).toString()}`); |
14 | 12 |
|
15 |
| - const lock = await hre.ethers.deployContract('Lock', [unlockTime], { |
16 |
| - value: lockedAmount, |
17 |
| - }); |
| 13 | + const contract = await ethers.deployContract('HouseformManager'); |
| 14 | + await contract.waitForDeployment(); |
18 | 15 |
|
19 |
| - await lock.waitForDeployment(); |
| 16 | + const contractAddress = await contract.getAddress(); |
20 | 17 |
|
21 |
| - console.log( |
22 |
| - `Lock with ${ethers.formatEther(lockedAmount)}ETH and unlock timestamp ${unlockTime} deployed to ${lock.target}`, |
23 |
| - ); |
| 18 | + console.log(`HouseformManager contract deployed`); |
| 19 | + console.log(`Contract address is ${contractAddress}`); |
| 20 | + console.log(`Check it on https://baobab.scope.klaytn.com/account/${contractAddress}`); |
24 | 21 | }
|
25 | 22 |
|
26 |
| -// We recommend this pattern to be able to use async/await everywhere |
27 |
| -// and properly handle errors. |
28 | 23 | main().catch((error) => {
|
29 | 24 | console.error(error);
|
30 | 25 | process.exitCode = 1;
|
|
0 commit comments