feat: add deployment configurations for Goerli, Polygon Mumbai, RSK Testnet, and Sepolia networks
refactor: update Hardhat config for cleaner network setup chore: remove outdated MockToken documentation fix: correct DEFAULT_SUPPLY initialization in MockToken module
This commit is contained in:
49
README.md
49
README.md
@@ -55,19 +55,13 @@
|
||||
|
||||
| Testnet | Token Address | P2pix Address | Reputation Address | Multicall Address |
|
||||
| ------- | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ |
|
||||
| Goerli | 0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00 | 0x2414817FF64A114d91eCFA16a834d3fCf69103d4 | 0x2CFD9354Ec7614fEf036EFd6A730dA1d5fC2762A | 0x8FE009992d96A86c7f0Bccdaf1eC3471E302a8a6 |
|
||||
| Mumbai | 0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29 | 0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00 | 0x570445E3eF413bCDb5De79ed27B1c3840683e385 | 0x718B2C4DE4F9654E1349F610ff561249bfe1c418 |
|
||||
| Sepolia | 0x3eBE212377D847828eBb9D2a100f5c5EA1EF3A72 | 0xb7cDAE58C6e715Cfd795BB142041E43b9CB02497 | 0xFd1194A56995Ef7B62730F4061408e79d88E5207 | 0x2f7f9848A803E67d79C0C8aa42b663dCF6E1B5ed |
|
||||
|
||||
<!-- All contracts deployed by 0x8dC06F985C131166570825F52447E8c88d64aE20 -->
|
||||
<!-- https://goerli.etherscan.io/address/0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00#code -->
|
||||
<!-- https://goerli.etherscan.io/address/0x2414817FF64A114d91eCFA16a834d3fCf69103d4#code -->
|
||||
<!-- https://goerli.etherscan.io/address/0x2CFD9354Ec7614fEf036EFd6A730dA1d5fC2762A#code -->
|
||||
<!-- https://goerli.etherscan.io/address/0x8FE009992d96A86c7f0Bccdaf1eC3471E302a8a6#code -->
|
||||
|
||||
<!-- https://mumbai.polygonscan.com/address/0xC86042E9F2977C62Da8c9dDF7F9c40fde4796A29#code -->
|
||||
<!-- https://mumbai.polygonscan.com/address/0x4A2886EAEc931e04297ed336Cc55c4eb7C75BA00#code -->
|
||||
<!-- https://mumbai.polygonscan.com/address/0x570445e3ef413bcdb5de79ed27b1c3840683e385#code -->
|
||||
<!-- https://mumbai.polygonscan.com/address/0x718B2C4DE4F9654E1349F610ff561249bfe1c418#code -->
|
||||
<!-- https://sepolia.etherscan.io/address/0x3eBE212377D847828eBb9D2a100f5c5EA1EF3A72#code -->
|
||||
<!-- https://sepolia.etherscan.io/address/0xb7cDAE58C6e715Cfd795BB142041E43b9CB02497#code -->
|
||||
<!-- https://sepolia.etherscan.io/address/0xFd1194A56995Ef7B62730F4061408e79d88E5207#code -->
|
||||
<!-- https://sepolia.etherscan.io/address/0x2f7f9848A803E67d79C0C8aa42b663dCF6E1B5ed#code -->
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -136,19 +130,17 @@ under `ignition/deployments/`.
|
||||
|
||||
- `ignition/modules/MockToken.ts` — ERC20 mock used in dev / testnets.
|
||||
- `ignition/modules/Reputation.ts` — Reputation + Multicall.
|
||||
- `ignition/modules/P2PIX.ts` — wires Reputation + MockToken and deploys
|
||||
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.
|
||||
- `ignition/modules/P2PIX.ts` — production deploy (no MockToken). Token
|
||||
addresses passed via parameters (`tokens` + `allowed`).
|
||||
- `ignition/modules/P2PIXWithMock.ts` — dev/test deploy. Wires Reputation +
|
||||
MockToken and deploys P2PIX.
|
||||
|
||||
### Per-network parameters
|
||||
|
||||
Network-specific values (e.g. `defaultBlocks`, `validSigners`, MockToken
|
||||
`supply`) live in `ignition/parameters/<network>.json`. Only
|
||||
`localhost.json` is checked in; copy it to e.g. `goerli.json` and set the
|
||||
network values before running the matching `deploy:*` script.
|
||||
`localhost.json` is checked in; copy it to e.g. `sepolia.json` and set the
|
||||
network values before running the deploy script.
|
||||
|
||||
### Local environment
|
||||
|
||||
@@ -161,7 +153,7 @@ yarn hardhat node
|
||||
On the second terminal:
|
||||
|
||||
```sh
|
||||
yarn deploy:localhost
|
||||
yarn deploy:mock --network localhost --parameters ignition/parameters/localhost.json
|
||||
```
|
||||
|
||||
Addresses for every deployed contract are written to
|
||||
@@ -171,17 +163,15 @@ gitignored — local-only state).
|
||||
### Testnets
|
||||
|
||||
```sh
|
||||
yarn deploy:goerli
|
||||
yarn deploy:sepolia
|
||||
yarn deploy:mumbai
|
||||
yarn deploy:mock --network sepolia
|
||||
```
|
||||
|
||||
Each command requires the matching `ignition/parameters/<network>.json`
|
||||
and the relevant API keys in `.env`.
|
||||
Requires the matching `ignition/parameters/sepolia.json` and the relevant
|
||||
API keys in `.env`.
|
||||
|
||||
### Deploying without MockToken (production / real tokens)
|
||||
### Production (real tokens)
|
||||
|
||||
Use the `P2PIXProd` module when the target network already has the ERC20
|
||||
Use the `P2PIX` 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
|
||||
@@ -192,11 +182,8 @@ tokens you want P2PIX to support — no MockToken is deployed.
|
||||
2. Run:
|
||||
|
||||
```sh
|
||||
yarn deploy:prod --network <network> --parameters ignition/parameters/<network>.json
|
||||
yarn deploy --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`.
|
||||
|
||||
@@ -1,224 +0,0 @@
|
||||
# MockToken
|
||||
|
||||
## Methods
|
||||
|
||||
### DOMAIN_SEPARATOR
|
||||
|
||||
```solidity
|
||||
function DOMAIN_SEPARATOR() external view returns (bytes32)
|
||||
```
|
||||
|
||||
#### Returns
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ------- | ----------- |
|
||||
| \_0 | bytes32 | undefined |
|
||||
|
||||
### allowance
|
||||
|
||||
```solidity
|
||||
function allowance(address, address) external view returns (uint256)
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ------- | ----------- |
|
||||
| \_0 | address | undefined |
|
||||
| \_1 | address | undefined |
|
||||
|
||||
#### Returns
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ------- | ----------- |
|
||||
| \_0 | uint256 | undefined |
|
||||
|
||||
### approve
|
||||
|
||||
```solidity
|
||||
function approve(address spender, uint256 amount) external nonpayable returns (bool)
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------- | ------- | ----------- |
|
||||
| spender | address | undefined |
|
||||
| amount | uint256 | undefined |
|
||||
|
||||
#### Returns
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| \_0 | bool | undefined |
|
||||
|
||||
### balanceOf
|
||||
|
||||
```solidity
|
||||
function balanceOf(address) external view returns (uint256)
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ------- | ----------- |
|
||||
| \_0 | address | undefined |
|
||||
|
||||
#### Returns
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ------- | ----------- |
|
||||
| \_0 | uint256 | undefined |
|
||||
|
||||
### decimals
|
||||
|
||||
```solidity
|
||||
function decimals() external view returns (uint8)
|
||||
```
|
||||
|
||||
#### Returns
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ----- | ----------- |
|
||||
| \_0 | uint8 | undefined |
|
||||
|
||||
### name
|
||||
|
||||
```solidity
|
||||
function name() external view returns (string)
|
||||
```
|
||||
|
||||
#### Returns
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| \_0 | string | undefined |
|
||||
|
||||
### nonces
|
||||
|
||||
```solidity
|
||||
function nonces(address) external view returns (uint256)
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ------- | ----------- |
|
||||
| \_0 | address | undefined |
|
||||
|
||||
#### Returns
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ------- | ----------- |
|
||||
| \_0 | uint256 | undefined |
|
||||
|
||||
### permit
|
||||
|
||||
```solidity
|
||||
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external nonpayable
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| -------- | ------- | ----------- |
|
||||
| owner | address | undefined |
|
||||
| spender | address | undefined |
|
||||
| value | uint256 | undefined |
|
||||
| deadline | uint256 | undefined |
|
||||
| v | uint8 | undefined |
|
||||
| r | bytes32 | undefined |
|
||||
| s | bytes32 | undefined |
|
||||
|
||||
### symbol
|
||||
|
||||
```solidity
|
||||
function symbol() external view returns (string)
|
||||
```
|
||||
|
||||
#### Returns
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| \_0 | string | undefined |
|
||||
|
||||
### totalSupply
|
||||
|
||||
```solidity
|
||||
function totalSupply() external view returns (uint256)
|
||||
```
|
||||
|
||||
#### Returns
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ------- | ----------- |
|
||||
| \_0 | uint256 | undefined |
|
||||
|
||||
### transfer
|
||||
|
||||
```solidity
|
||||
function transfer(address to, uint256 amount) external nonpayable returns (bool)
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------ | ------- | ----------- |
|
||||
| to | address | undefined |
|
||||
| amount | uint256 | undefined |
|
||||
|
||||
#### Returns
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| \_0 | bool | undefined |
|
||||
|
||||
### transferFrom
|
||||
|
||||
```solidity
|
||||
function transferFrom(address from, address to, uint256 amount) external nonpayable returns (bool)
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------ | ------- | ----------- |
|
||||
| from | address | undefined |
|
||||
| to | address | undefined |
|
||||
| amount | uint256 | undefined |
|
||||
|
||||
#### Returns
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| \_0 | bool | undefined |
|
||||
|
||||
## Events
|
||||
|
||||
### Approval
|
||||
|
||||
```solidity
|
||||
event Approval(address indexed owner, address indexed spender, uint256 amount)
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| ----------------- | ------- | ----------- |
|
||||
| owner `indexed` | address | undefined |
|
||||
| spender `indexed` | address | undefined |
|
||||
| amount | uint256 | undefined |
|
||||
|
||||
### Transfer
|
||||
|
||||
```solidity
|
||||
event Transfer(address indexed from, address indexed to, uint256 amount)
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| -------------- | ------- | ----------- |
|
||||
| from `indexed` | address | undefined |
|
||||
| to `indexed` | address | undefined |
|
||||
| amount | uint256 | undefined |
|
||||
@@ -1,16 +0,0 @@
|
||||
# Solidity API
|
||||
|
||||
## MockToken
|
||||
|
||||
### constructor
|
||||
|
||||
```solidity
|
||||
constructor(uint256 supply) public
|
||||
```
|
||||
|
||||
### mint
|
||||
|
||||
```solidity
|
||||
function mint(address[] to, uint256 value) public virtual
|
||||
```
|
||||
|
||||
@@ -24,9 +24,10 @@ const chainIds = {
|
||||
localhost: 31337,
|
||||
mainnet: 1,
|
||||
"eth-sepolia": 11155111,
|
||||
"polygon-mumbai": 80001,
|
||||
rootstock:30,
|
||||
"rootstock-testnet":31,
|
||||
"polygon-mainnet": 137,
|
||||
"arb-mainnet": 42161,
|
||||
rootstock: 30,
|
||||
"rootstock-testnet": 31,
|
||||
};
|
||||
|
||||
function getChainConfig(
|
||||
@@ -56,9 +57,9 @@ const config: HardhatUserConfig = {
|
||||
etherscan: {
|
||||
apiKey: {
|
||||
mainnet: process.env.ETHERSCAN_API_KEY || "",
|
||||
rinkeby: process.env.ETHERSCAN_API_KEY || "",
|
||||
goerli: process.env.ETHERSCAN_API_KEY || "",
|
||||
polygonMumbai: process.env.POLYGONSCAN_API_KEY || "",
|
||||
sepolia: process.env.ETHERSCAN_API_KEY || "",
|
||||
polygon: process.env.POLYGONSCAN_API_KEY || "",
|
||||
arbitrumOne: process.env.ARBISCAN_API_KEY || "",
|
||||
},
|
||||
},
|
||||
gasReporter: {
|
||||
@@ -94,11 +95,12 @@ const config: HardhatUserConfig = {
|
||||
},
|
||||
},
|
||||
// network: getChainConfig("{INSERT_NAME}"),
|
||||
mainnet: () => getChainConfig("mainnet"),
|
||||
sepolia: () => getChainConfig("eth-sepolia"),
|
||||
mumbai: () => getChainConfig("polygon-mumbai"),
|
||||
rootstock: () => getChainConfig("rootstock"),
|
||||
rsktestnet: () => getChainConfig("rootstock-testnet"),
|
||||
mainnet: getChainConfig("mainnet"),
|
||||
sepolia: getChainConfig("eth-sepolia"),
|
||||
polygon: getChainConfig("polygon-mainnet"),
|
||||
arbitrum: getChainConfig("arb-mainnet"),
|
||||
rootstock: getChainConfig("rootstock"),
|
||||
rsktestnet: getChainConfig("rootstock-testnet"),
|
||||
},
|
||||
paths: {
|
||||
artifacts: "./artifacts",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
|
||||
import { ethers } from "ethers";
|
||||
|
||||
const DEFAULT_SUPPLY = ethers.utils
|
||||
const DEFAULT_SUPPLY = ethers
|
||||
.parseEther("20000000")
|
||||
.toString();
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
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,
|
||||
);
|
||||
@@ -14,19 +12,20 @@ export default buildModule("P2PIX", m => {
|
||||
"validSigners",
|
||||
[],
|
||||
);
|
||||
const tokens = m.getParameter<string[]>("tokens");
|
||||
const allowed = m.getParameter<boolean[]>("allowed");
|
||||
|
||||
const p2pix = m.contract("P2PIX", [
|
||||
defaultBlocks,
|
||||
validSigners,
|
||||
reputation,
|
||||
[token],
|
||||
[true],
|
||||
tokens,
|
||||
allowed,
|
||||
]);
|
||||
|
||||
return {
|
||||
p2pix,
|
||||
reputation,
|
||||
multicall,
|
||||
token,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
|
||||
|
||||
import MockTokenModule from "./MockToken";
|
||||
import ReputationModule from "./Reputation";
|
||||
|
||||
export default buildModule("P2PIXProd", m => {
|
||||
export default buildModule("P2PIXWithMock", m => {
|
||||
const { token } = m.useModule(MockTokenModule);
|
||||
const { reputation, multicall } = m.useModule(
|
||||
ReputationModule,
|
||||
);
|
||||
@@ -12,20 +14,19 @@ export default buildModule("P2PIXProd", m => {
|
||||
"validSigners",
|
||||
[],
|
||||
);
|
||||
const tokens = m.getParameter<string[]>("tokens");
|
||||
const allowed = m.getParameter<boolean[]>("allowed");
|
||||
|
||||
const p2pix = m.contract("P2PIX", [
|
||||
defaultBlocks,
|
||||
validSigners,
|
||||
reputation,
|
||||
tokens,
|
||||
allowed,
|
||||
[token],
|
||||
[true],
|
||||
]);
|
||||
|
||||
return {
|
||||
p2pix,
|
||||
reputation,
|
||||
multicall,
|
||||
token,
|
||||
};
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"P2PIX": {
|
||||
"P2PIXWithMock": {
|
||||
"defaultBlocks": 10,
|
||||
"validSigners": []
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"P2PIXProd": {
|
||||
"P2PIX": {
|
||||
"defaultBlocks": 10,
|
||||
"validSigners": [],
|
||||
"tokens": ["0x0000000000000000000000000000000000000000"],
|
||||
|
||||
@@ -13,11 +13,8 @@
|
||||
"compile": "hardhat compile",
|
||||
"typechain": "hardhat typechain",
|
||||
"test": "hardhat test",
|
||||
"deploy:localhost": "hardhat ignition deploy ignition/modules/P2PIX.ts --network localhost --parameters ignition/parameters/localhost.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: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",
|
||||
"deploy": "hardhat ignition deploy ignition/modules/P2PIX.ts",
|
||||
"deploy:mock": "hardhat ignition deploy ignition/modules/P2PIXWithMock.ts",
|
||||
"coverage": "hardhat coverage --solcoverjs ./.solcover.js --temp artifacts --testfiles \"test/**/*.ts\" && yarn typechain",
|
||||
"lint": "yarn lint:sol && yarn lint:ts && yarn prettier:check",
|
||||
"lint:sol": "solhint --config ./.solhint.json --max-warnings 0 \"contracts/**/*.sol\"",
|
||||
|
||||
Reference in New Issue
Block a user