Skip to content

Commit 46434fc

Browse files
authored
Merge pull request #6294 from NomicFoundation/feat/add-ignition-to-viem-template
add ignition to the viem template
2 parents 21d99a5 + 21d4c2b commit 46434fc

File tree

6 files changed

+54
-0
lines changed

6 files changed

+54
-0
lines changed

pnpm-lock.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.24;
3+
4+
contract Rocket {
5+
string public name;
6+
string public status;
7+
8+
constructor(string memory _name) {
9+
name = _name;
10+
status = "ignition";
11+
}
12+
13+
function launch() public {
14+
status = "lift-off";
15+
}
16+
}

v-next/hardhat/templates/01-node-test-runner-viem/hardhat.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import HardhatNodeTestRunner from "@ignored/hardhat-vnext-node-test-runner";
77
import HardhatViem from "@ignored/hardhat-vnext-viem";
88
import HardhatNetworkHelpers from "@ignored/hardhat-vnext-network-helpers";
99
import HardhatKeystore from "@ignored/hardhat-vnext-keystore";
10+
import HardhatIgnitionViem from "@ignored/hardhat-vnext-ignition-viem";
1011

1112
const config: HardhatUserConfig = {
1213
/*
@@ -21,6 +22,7 @@ const config: HardhatUserConfig = {
2122
HardhatViem,
2223
HardhatNetworkHelpers,
2324
HardhatKeystore,
25+
HardhatIgnitionViem,
2426
],
2527
solidity: {
2628
/*
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { buildModule } from "@ignored/hardhat-vnext-ignition/modules";
2+
3+
export default buildModule("Apollo", (m) => {
4+
const apollo = m.contract("Rocket", ["Saturn V"]);
5+
6+
m.call(apollo, "launch", []);
7+
8+
return { apollo };
9+
});

v-next/hardhat/templates/01-node-test-runner-viem/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"type": "module",
77
"devDependencies": {
88
"@ignored/hardhat-vnext": "workspace:^3.0.0-next.18",
9+
"@ignored/hardhat-vnext-ignition": "workspace:^2.0.0",
10+
"@ignored/hardhat-vnext-ignition-viem": "workspace:^2.0.0",
911
"@ignored/hardhat-vnext-keystore": "workspace:^3.0.0-next.14",
1012
"@ignored/hardhat-vnext-node-test-runner": "workspace:^3.0.0-next.14",
1113
"@ignored/hardhat-vnext-network-helpers": "workspace:^3.0.0-next.14",
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import hre from "@ignored/hardhat-vnext";
2+
3+
import apolloModule from "../ignition/modules/Apollo.js";
4+
5+
const { ignition } = await hre.network.connect();
6+
7+
const { apollo } = await ignition.deploy(apolloModule);
8+
9+
const address = apollo.address;
10+
const name = await apollo.read.name();
11+
const status = await apollo.read.status();
12+
13+
console.log(
14+
`Deployed rocket with Ignition and Viem from a Hardhat Script 🚀
15+
16+
address: ${address}
17+
name: ${name}
18+
status: ${status}`,
19+
);

0 commit comments

Comments
 (0)