Replace the imperative deploy scripts with Hardhat Ignition modules:
- ignition/modules/{MockToken,Reputation,P2PIX}.ts orchestrate the full
deployment graph; P2PIX.ts wires MockToken + Reputation and deploys
P2PIX via its constructor
- ignition/parameters/localhost.json holds per-network values
(defaultBlocks, validSigners, MockToken supply)
- swap hardhat-toolbox for the individual plugins that Ignition needs;
add hardhat-verify (v2) and bump hardhat/hardhat-tracer accordingly
- delete scripts/1-deploy-mockToken.ts and scripts/2-deploy-p2pix.ts
- add deploy:{localhost,goerli,sepolia,mumbai} npm scripts
- include ignition/**/* in tsconfig.json
- gitignore ignition/deployments/chain-31337/ (ephemeral local state)
This branch carries the deployment-tooling migration only — the contract
is still the original constructor-based P2PIX. Proxy / UUPS deploy
support will land alongside the upgradeable contract change.
33 lines
673 B
TypeScript
33 lines
673 B
TypeScript
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
|
|
|
|
import MockTokenModule from "./MockToken";
|
|
import ReputationModule from "./Reputation";
|
|
|
|
export default buildModule("P2PIX", m => {
|
|
const { token } = m.useModule(MockTokenModule);
|
|
const { reputation, multicall } = m.useModule(
|
|
ReputationModule,
|
|
);
|
|
|
|
const defaultBlocks = m.getParameter("defaultBlocks", 10);
|
|
const validSigners = m.getParameter<string[]>(
|
|
"validSigners",
|
|
[],
|
|
);
|
|
|
|
const p2pix = m.contract("P2PIX", [
|
|
defaultBlocks,
|
|
validSigners,
|
|
reputation,
|
|
[token],
|
|
[true],
|
|
]);
|
|
|
|
return {
|
|
p2pix,
|
|
reputation,
|
|
multicall,
|
|
token,
|
|
};
|
|
});
|