-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6294 from NomicFoundation/feat/add-ignition-to-vi…
…em-template add ignition to the viem template
- Loading branch information
Showing
6 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
v-next/hardhat/templates/01-node-test-runner-viem/contracts/Rocket.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.24; | ||
|
||
contract Rocket { | ||
string public name; | ||
string public status; | ||
|
||
constructor(string memory _name) { | ||
name = _name; | ||
status = "ignition"; | ||
} | ||
|
||
function launch() public { | ||
status = "lift-off"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
v-next/hardhat/templates/01-node-test-runner-viem/ignition/modules/Apollo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { buildModule } from "@ignored/hardhat-vnext-ignition/modules"; | ||
|
||
export default buildModule("Apollo", (m) => { | ||
const apollo = m.contract("Rocket", ["Saturn V"]); | ||
|
||
m.call(apollo, "launch", []); | ||
|
||
return { apollo }; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
v-next/hardhat/templates/01-node-test-runner-viem/scripts/deploy-rocket-from-script.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import hre from "@ignored/hardhat-vnext"; | ||
|
||
import apolloModule from "../ignition/modules/Apollo.js"; | ||
|
||
const { ignition } = await hre.network.connect(); | ||
|
||
const { apollo } = await ignition.deploy(apolloModule); | ||
|
||
const address = apollo.address; | ||
const name = await apollo.read.name(); | ||
const status = await apollo.read.status(); | ||
|
||
console.log( | ||
`Deployed rocket with Ignition and Viem from a Hardhat Script 🚀 | ||
address: ${address} | ||
name: ${name} | ||
status: ${status}`, | ||
); |