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.
- Declare 'localhost' network in hardhat.config.ts pointing to
http://127.0.0.1:8545 (chainId 31337) so deploy scripts work
against an external Anvil/Hardhat node.
- Make MNEMONIC and ALCHEMY_API_KEY optional: fall back to the
Hardhat/Anvil deterministic mnemonic when MNEMONIC is missing,
and only require ALCHEMY_API_KEY when targeting public networks.
- Reset deploys/localhost.json to a starter state (signers populated,
contract addresses empty) so the frontend e2e setup writes fresh
addresses on every run.
Typescript updated to v5.
Notably all calls to p2pix.callStatic.getStr() were replaced by viem.stringToHex() due to bug in ethers (https://github.com/ethers-io/ethers.js/issues/4965)
Full migration to viem might not be possible currently due to hard-chai-matchers incompatibility:
> The hardhat-chai-matchers plugin is designed to work with hardhat-ethers. Attempting to use it in conjunction with hardhat-viem results in compatibility issues.
https://hardhat.org/hardhat-chai-matchers/docs/overview