|
1 | | -import { HardhatRuntimeEnvironment } from "hardhat/types"; |
2 | | -import { DeployFunction } from "hardhat-deploy/types"; |
3 | | -import { Contract } from "ethers"; |
| 1 | +import { artifacts, deployScript } from "../rocketh/deploy.js"; |
4 | 2 |
|
5 | 3 | /** |
6 | | - * Deploys a contract named "YourCollectible" using the deployer account and |
7 | | - * constructor arguments set to the deployer address |
| 4 | + * Deploys a contract named "YourCollectible". |
8 | 5 | * |
9 | | - * @param hre HardhatRuntimeEnvironment object. |
| 6 | + * On localhost, the deployer account is the one that comes with Hardhat, which is already funded. |
| 7 | + * |
| 8 | + * When deploying to live networks (e.g `yarn deploy --network sepolia`), the deployer account |
| 9 | + * should have sufficient balance to pay for the gas fees for contract creation. |
| 10 | + * |
| 11 | + * You can generate a random account with `yarn generate` which will fill DEPLOYER_PRIVATE_KEY_ENCRYPTED |
| 12 | + * in the .env file (used in hardhat.config.ts). |
| 13 | + * Run `yarn account` to check the deployer balance on every network. |
10 | 14 | */ |
11 | | -const deployYourCollectible: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { |
12 | | - /* |
13 | | - On localhost, the deployer account is the one that comes with Hardhat, which is already funded. |
14 | | -
|
15 | | - When deploying to live networks (e.g `yarn deploy --network sepolia`), the deployer account |
16 | | - should have sufficient balance to pay for the gas fees for contract creation. |
17 | | -
|
18 | | - You can generate a random account with `yarn generate` which will fill DEPLOYER_PRIVATE_KEY |
19 | | - with a random private key in the .env file (then used on hardhat.config.ts) |
20 | | - You can run the `yarn account` command to check your balance in every network. |
21 | | - */ |
22 | | - const { deployer } = await hre.getNamedAccounts(); |
23 | | - const { deploy } = hre.deployments; |
24 | | - |
25 | | - await deploy("YourCollectible", { |
26 | | - from: deployer, |
27 | | - // Contract constructor arguments |
28 | | - args: [], |
29 | | - log: true, |
30 | | - // autoMine: can be passed to the deploy function to make the deployment process faster on local networks by |
31 | | - // automatically mining the contract deployment transaction. There is no effect on live networks. |
32 | | - autoMine: true, |
33 | | - }); |
34 | | - |
35 | | - // Get the deployed contract to interact with it after deploying. |
36 | | - const yourCollectible = await hre.ethers.getContract<Contract>("YourCollectible", deployer); |
37 | | -}; |
38 | | - |
39 | | -export default deployYourCollectible; |
| 15 | +export default deployScript( |
| 16 | + async ({ deploy, namedAccounts }) => { |
| 17 | + const { deployer } = namedAccounts; |
40 | 18 |
|
41 | | -// Tags are useful if you have multiple deploy files and only want to run one of them. |
42 | | -// e.g. yarn deploy --tags YourCollectible |
43 | | -deployYourCollectible.tags = ["YourCollectible"]; |
| 19 | + await deploy("YourCollectible", { |
| 20 | + account: deployer, |
| 21 | + artifact: artifacts.YourCollectible, |
| 22 | + args: [], |
| 23 | + }); |
| 24 | + }, |
| 25 | + // Tags are useful if you have multiple deploy files and only want to run one of them. |
| 26 | + // e.g. yarn deploy --tags YourCollectible |
| 27 | + { tags: ["YourCollectible"] }, |
| 28 | +); |
0 commit comments