feat: add P2PIXProd Ignition module for deploys without MockToken
This commit is contained in:
26
README.md
26
README.md
@@ -138,6 +138,10 @@ under `ignition/deployments/`.
|
|||||||
- `ignition/modules/Reputation.ts` — Reputation + Multicall.
|
- `ignition/modules/Reputation.ts` — Reputation + Multicall.
|
||||||
- `ignition/modules/P2PIX.ts` — wires Reputation + MockToken and deploys
|
- `ignition/modules/P2PIX.ts` — wires Reputation + MockToken and deploys
|
||||||
P2PIX via its constructor, returning the full set of addresses.
|
P2PIX via its constructor, returning the full set of addresses.
|
||||||
|
- `ignition/modules/P2PIXProd.ts` — same as `P2PIX.ts` but **does not**
|
||||||
|
deploy MockToken. Token addresses are passed in via parameters
|
||||||
|
(`tokens` + `allowed`), so existing on-chain tokens (e.g. BRZ, USDC)
|
||||||
|
can be wired directly.
|
||||||
|
|
||||||
### Per-network parameters
|
### Per-network parameters
|
||||||
|
|
||||||
@@ -174,3 +178,25 @@ yarn deploy:mumbai
|
|||||||
|
|
||||||
Each command requires the matching `ignition/parameters/<network>.json`
|
Each command requires the matching `ignition/parameters/<network>.json`
|
||||||
and the relevant API keys in `.env`.
|
and the relevant API keys in `.env`.
|
||||||
|
|
||||||
|
### Deploying without MockToken (production / real tokens)
|
||||||
|
|
||||||
|
Use the `P2PIXProd` module when the target network already has the ERC20
|
||||||
|
tokens you want P2PIX to support — no MockToken is deployed.
|
||||||
|
|
||||||
|
1. Copy `ignition/parameters/prod.example.json` to
|
||||||
|
`ignition/parameters/<network>.json` and set:
|
||||||
|
- `defaultBlocks`, `validSigners`
|
||||||
|
- `tokens` — array of ERC20 addresses on the target network
|
||||||
|
- `allowed` — array of booleans, same length as `tokens`
|
||||||
|
2. Run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn deploy:prod --network <network> --parameters ignition/parameters/<network>.json
|
||||||
|
```
|
||||||
|
|
||||||
|
(e.g. `--network mainnet` or `--network polygon`, with the network
|
||||||
|
defined in `hardhat.config.ts`).
|
||||||
|
|
||||||
|
The deployed Reputation/Multicall/P2PIX addresses are written to
|
||||||
|
`ignition/deployments/chain-<id>/deployed_addresses.json`.
|
||||||
|
|||||||
31
ignition/modules/P2PIXProd.ts
Normal file
31
ignition/modules/P2PIXProd.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
|
||||||
|
|
||||||
|
import ReputationModule from "./Reputation";
|
||||||
|
|
||||||
|
export default buildModule("P2PIXProd", m => {
|
||||||
|
const { reputation, multicall } = m.useModule(
|
||||||
|
ReputationModule,
|
||||||
|
);
|
||||||
|
|
||||||
|
const defaultBlocks = m.getParameter("defaultBlocks", 10);
|
||||||
|
const validSigners = m.getParameter<string[]>(
|
||||||
|
"validSigners",
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
const tokens = m.getParameter<string[]>("tokens");
|
||||||
|
const allowed = m.getParameter<boolean[]>("allowed");
|
||||||
|
|
||||||
|
const p2pix = m.contract("P2PIX", [
|
||||||
|
defaultBlocks,
|
||||||
|
validSigners,
|
||||||
|
reputation,
|
||||||
|
tokens,
|
||||||
|
allowed,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return {
|
||||||
|
p2pix,
|
||||||
|
reputation,
|
||||||
|
multicall,
|
||||||
|
};
|
||||||
|
});
|
||||||
8
ignition/parameters/prod.example.json
Normal file
8
ignition/parameters/prod.example.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"P2PIXProd": {
|
||||||
|
"defaultBlocks": 10,
|
||||||
|
"validSigners": [],
|
||||||
|
"tokens": ["0x0000000000000000000000000000000000000000"],
|
||||||
|
"allowed": [true]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
"deploy:goerli": "hardhat ignition deploy ignition/modules/P2PIX.ts --network goerli --parameters ignition/parameters/goerli.json",
|
"deploy:goerli": "hardhat ignition deploy ignition/modules/P2PIX.ts --network goerli --parameters ignition/parameters/goerli.json",
|
||||||
"deploy:sepolia": "hardhat ignition deploy ignition/modules/P2PIX.ts --network sepolia --parameters ignition/parameters/sepolia.json",
|
"deploy:sepolia": "hardhat ignition deploy ignition/modules/P2PIX.ts --network sepolia --parameters ignition/parameters/sepolia.json",
|
||||||
"deploy:mumbai": "hardhat ignition deploy ignition/modules/P2PIX.ts --network polygon-mumbai --parameters ignition/parameters/mumbai.json",
|
"deploy:mumbai": "hardhat ignition deploy ignition/modules/P2PIX.ts --network polygon-mumbai --parameters ignition/parameters/mumbai.json",
|
||||||
|
"deploy:prod": "hardhat ignition deploy ignition/modules/P2PIXProd.ts",
|
||||||
"coverage": "hardhat coverage --solcoverjs ./.solcover.js --temp artifacts --testfiles \"test/**/*.ts\" && yarn typechain",
|
"coverage": "hardhat coverage --solcoverjs ./.solcover.js --temp artifacts --testfiles \"test/**/*.ts\" && yarn typechain",
|
||||||
"lint": "yarn lint:sol && yarn lint:ts && yarn prettier:check",
|
"lint": "yarn lint:sol && yarn lint:ts && yarn prettier:check",
|
||||||
"lint:sol": "solhint --config ./.solhint.json --max-warnings 0 \"contracts/**/*.sol\"",
|
"lint:sol": "solhint --config ./.solhint.json --max-warnings 0 \"contracts/**/*.sol\"",
|
||||||
|
|||||||
Reference in New Issue
Block a user