Skip to content

Commit

Permalink
update deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
santteegt committed Jun 3, 2024
1 parent caea846 commit d162382
Show file tree
Hide file tree
Showing 9 changed files with 312 additions and 179 deletions.
104 changes: 43 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,74 +292,74 @@ pnpm hardhat memberlist:generate
`./constants/config.ts`

```sh
pnpm hardhat --network goerli deploy:split --controller
pnpm hardhat --network optimismGoerli deploy:split --controller
pnpm hardhat --network arbitrumGoerli deploy:split --controller
# Split V1
pnpm hardhat --network sepolia deploy:split --controller
pnpm hardhat --network optimismSepolia deploy:split --controller
pnpm hardhat --network arbitrumSepolia deploy:split --controller
```

The `--controller` flag will set the deployer address as the 0xSplit controller..

- **Deploy & Verify Registry Summoner + Singleton contracts** on relevant test networks (OPTIONAL as these should be
already deployed)

```sh
pnpm hardhat --network goerli deploy --tags Summoner
pnpm hardhat --network goerli etherscan-verify

pnpm hardhat --network optimismGoerli deploy --tags Summoner
pnpm hardhat --network optimismGoerli etherscan-verify

pnpm hardhat --network arbitrumGoerli deploy --tags Summoner
pnpm hardhat --network arbitrumGoerli etherscan-verify
# Split V2
pnpm hardhat --network sepolia deploy:splitV2 --controller
pnpm hardhat --network optimismSepolia deploy:splitV2 --controller
pnpm hardhat --network arbitrumSepolia deploy:splitV2 --controller
```

The `--controller` flag will set the deployer address as the 0xSplit controller..

- **Deploy a Main NetworkRegistry** using the deploy script. The registry will be owned either by `safe` address, or
`moloch`.avatar() address you define in `./constants/config.ts`, otherwise the `deployer` will be set as owner by
default. Finally don't forget to set the `pgRegistry` to the deployed contract address in `./constants/config.ts`.

Using Summoner:
GuildRegistry:

```sh
pnpm hardhat --network goerli deploy --tags PGNetworkRegistry
pnpm hardhat --network sepolia deploy --tags GuildRegistry
# or using SplitV2
pnpm hardhat --network sepolia deploy --tags GuildRegistryV2
```

Using UUPS Proxy:
NetworkRegistry:

```sh
pnpm hardhat --network sepolia deploy --tags UpgradeablePGNetworkRegistry
pnpm hardhat --network sepolia deploy --tags NetworkRegistry
# or using SplitV2
pnpm hardhat --network sepolia deploy --tags NetworkRegistryV2
```

- **Transfer 0xSplit control to NetworkRegistry contract**: if NetworkRegistry is owner by the DAO safe, remember to
trigger an action later to accept control.

```sh
pnpm hardhat --network goerli registry:ownSplit
pnpm hardhat --network sepolia registry:ownSplit
```

- **Deploy a Replica NetworkRegistry on relevant L2's**. The registry will be owned by a temporary `registryOwner`
address if set in `./constants/config.ts`, otherwise the `deployer` will renounce ownership (Zero address) by default.
Finally don't forget to set the `pgRegistry` to the deployed contract address in `./constants/config.ts`.

Using Summoner:
GuildRegistry:

```sh
pnpm hardhat --network optimismGoerli deploy --tags PGNetworkRegistry
pnpm hardhat --network arbitrumGoerli deploy --tags PGNetworkRegistry
pnpm hardhat --network optimismSepolia deploy --tags GuildRegistry
# or using SplitV2
pnpm hardhat --network optimismSepolia deploy --tags GuildRegistryV2
```

Using UUPS Proxy:
NetworkRegistry:

```sh
pnpm hardhat --network optimismSepolia deploy --tags UpgradeablePGNetworkRegistry
pnpm hardhat --network arbitrumSepolia deploy --tags UpgradeablePGNetworkRegistry
pnpm hardhat --network optimismSepolia deploy --tags NetworkRegistry
# or using SplitV2
pnpm hardhat --network optimismSepolia deploy --tags NetworkRegistryV2
```

- **Register a new Replicas on the Main NetworkRegistry**

```
pnpm hardhat --network goerli registry:addNetwork --foreign-chain-id 420 --foreign-domain-id 1735356532 --foreign-registry-address <registry_address>
pnpm hardhat --network sepolia registry:addNetwork --foreign-chain-id 420 --foreign-domain-id 1735356532 --foreign-registry-address <registry_address>
pnpm hardhat --network goerli registry:addNetwork --foreign-chain-id 421613 --foreign-domain-id 1734439522 --foreign-registry-address <registry_address>
pnpm hardhat --network sepolia registry:addNetwork --foreign-chain-id 421613 --foreign-domain-id 1734439522 --foreign-registry-address <registry_address>
```

- **Transfer 0xSplit control in L2s to replica NetworkRegistry contracts**. In case of Replica registries that have
Expand All @@ -375,50 +375,32 @@ pnpm hardhat --network goerli registry:addNetwork --foreign-chain-id 421613 --fo
- **Test New Member Sync Action**

```
pnpm hardhat --network goerli registry:newMember --member <member_address> --multiplier 100
pnpm hardhat --network sepolia registry:newMember --member <member_address> --multiplier 100
```

- Copy the hash from the latest tx and open
[Goerli subgraph](https://thegraph.com/hosted-service/subgraph/connext/nxtp-amarok-runtime-v0-goerli)
[Sepolia subgraph](https://thegraph.com/hosted-service/subgraph/connext/runtime-v1-sepolia)
- Copy/Paste Origin Transfer query from [this link](https://docs.connext.network/developers/guides/xcall-status) and
replace the txHash parameter. You'll get the `transferId` from both cross-chain actions submitted to optimism and
arbitrum
- Open [Connextscan]() to monitor cross-chain actions status. It usually takes ~30min to get a Complete status (Tx
- Open [Connextscan](https://testnet.connextscan.io/) to monitor cross-chain actions status. It usually takes ~30min to get a Complete status (Tx
Reconciled & Executed)

## Deployed Contracts

### Sepolia

| Contract | Address |
| ------------------------------ | ------- |
| NetworkRegistry Proxy | TBD |
| NetworkRegistry Implementation | TBD |
| PGContribCalculator | TBD |

### ~~Goerli~~

| Contract | Address |
| ------------------------------- | ---------------------------------------------- |
| NetworkRegistrySummoner | ~~0xd1a8c3b7F7250b50E352b51d148A29f24C0CeD62~~ |
| NetworkRegistry Singleton | ~~0x250F9e93822cD48269E8a24A9D4bE817A9cf389D~~ |
| NetworkRegistryShaman Singleton | <None> |

### ~~Optimism Goerli~~

| Contract | Address |
| ------------------------------- | ---------------------------------------------- |
| NetworkRegistrySummoner | ~~0x7D32b8Ae083d78ff6628271a15B162676380bd00~~ |
| NetworkRegistry Singleton | ~~0xF3C93FBa186758605318b2F6d0b141029a20E2a8~~ |
| NetworkRegistryShaman Singleton | <None> |

### ~~Arbitrum Goerli~~

| Contract | Address |
| ------------------------------- | ---------------------------------------------- |
| NetworkRegistrySummoner | ~~0x7D32b8Ae083d78ff6628271a15B162676380bd00~~ |
| NetworkRegistry Singleton | ~~0xF3C93FBa186758605318b2F6d0b141029a20E2a8~~ |
| NetworkRegistryShaman Singleton | <None> |
| Contract | Address |
| --------------------------------- | ------- |
| NetworkRegistry Proxy | TBD |
| NetworkRegistry Implementation | TBD |
| NetworkRegistryV2 Proxy | TBD |
| NetworkRegistryV2 Implementation | TBD |
| GuildRegistry Proxy | TBD |
| GuildRegistry Implementation | TBD |
| GuildRegistryV2 Proxy | TBD |
| GuildRegistryV2 Implementation | TBD |
| PGContribCalculator | TBD |

### Polygon Mumbai

Expand Down
88 changes: 29 additions & 59 deletions constants/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 0xSplits contracts
export const defaultSplitsConfig = {
splitMain: "0x2ed6c4B5dA6378c7897AC67Ba9e43102Feb694EE", // same address on all live/test networks
splitV2Factory: "0x80f1B766817D04870f115fEBbcCADF8DBF75E017", // PullSplitFactory
};

// NOTICE: DAO + Connext + 0xSplits config
Expand All @@ -14,6 +15,8 @@ export const deploymentConfig: { [key: string]: any } = {
safe: "", // TODO:
splitMain: defaultSplitsConfig.splitMain,
split: "", // TODO:
splitv2: "", // TODO:
splitV2Factory: defaultSplitsConfig.splitV2Factory,
pgRegistry: "", // TODO:
},
"100": {
Expand All @@ -26,6 +29,8 @@ export const deploymentConfig: { [key: string]: any } = {
safe: "", // TODO:
splitMain: defaultSplitsConfig.splitMain,
split: "", // TODO:
splitv2: "", // TODO:
splitV2Factory: defaultSplitsConfig.splitV2Factory,
pgRegistry: "", // TODO:
},
"137": {
Expand All @@ -38,6 +43,8 @@ export const deploymentConfig: { [key: string]: any } = {
safe: "", // TODO:
splitMain: defaultSplitsConfig.splitMain,
split: "", // TODO:
splitv2: "", // TODO:
splitV2Factory: defaultSplitsConfig.splitV2Factory,
pgRegistry: "", // TODO:
},
"42161": {
Expand All @@ -50,6 +57,8 @@ export const deploymentConfig: { [key: string]: any } = {
safe: "", // TODO:
splitMain: defaultSplitsConfig.splitMain,
split: "", // TODO:
splitv2: "", // TODO:
splitV2Factory: defaultSplitsConfig.splitV2Factory,
pgRegistry: "", // TODO:
},
"10": {
Expand All @@ -62,87 +71,48 @@ export const deploymentConfig: { [key: string]: any } = {
safe: "", // TODO:
splitMain: defaultSplitsConfig.splitMain,
split: "", // TODO:
splitv2: "", // TODO:
splitV2Factory: defaultSplitsConfig.splitV2Factory,
pgRegistry: "", // TODO:
},
"5": {
// goerli
domainId: 1735353714,
connext: "0xFCa08024A6D4bCc87275b1E4A1E22B71fAD7f649",
moloch: "0xbfb34e1e13d68922cb86769f4abcdab9bd68e5ff", // TODO:
safe: "0x7201030e136734e92560427b1346af2219d12074", // TODO:
splitMain: defaultSplitsConfig.splitMain,
split: "0xe650e123237920d5f620579fb42670145361a0a9", // TODO:
pgRegistry: "0x9eF64c547477b2263ed56821ce6Be79564824F44", // TODO:
},
"80001": {
// mumbai
l2: true,
domainId: 9991,
connext: "0x2334937846Ab2A3FCE747b32587e1A1A2f6EEC5a",
registryOwner: "0x10136Fa41B6522E4DBd068C6F7D80373aBbCFBe6", // TODO:
moloch: "",
safe: "",
splitMain: defaultSplitsConfig.splitMain,
split: "0x6f9a5dc2903a2bcb51caf05978e4f260a531c578", // TODO:
pgRegistry: "0x07E1eF1E6Eff099c082232a9AcA0Fa5551602d62", // TODO:
},
"420": {
// optimismGoerli
l2: true,
domainId: 1735356532,
connext: "0x5Ea1bb242326044699C3d81341c5f535d5Af1504",
registryOwner: "0x10136Fa41B6522E4DBd068C6F7D80373aBbCFBe6", // TODO:
moloch: "",
safe: "",
splitsMain: "0x2ed6c4B5dA6378c7897AC67Ba9e43102Feb694EE",
splitMain: defaultSplitsConfig.splitMain,
split: "0xb12a8499c8aca88fe2270ba5552d0a2a1fd8b7fe", // TODO:
pgRegistry: "0x8054874b08783070a189218a22e7ffb4600430c0", // TODO:
},
"421613": {
// arbitrumGoerli
l2: true,
domainId: 1734439522,
connext: "0x2075c9E31f973bb53CAE5BAC36a8eeB4B082ADC2",
registryOwner: "0x10136Fa41B6522E4DBd068C6F7D80373aBbCFBe6", // TODO:
moloch: "",
safe: "",
splitMain: defaultSplitsConfig.splitMain,
split: "0x14ff51c8806f1730d64137fcf79ba38c67d593c8", // TODO:
pgRegistry: "0x8054874b08783070a189218a22e7ffb4600430c0", // TODO:
},
"11155111": {
// sepolia
domainId: 0, // TODO:
connext: "0xFCa08024A6D4bCc87275b1E4A1E22B71fAD7f649", // TODO:
moloch: "0x832ec97051ed6a1abdbafa74dace307af59b1ef3", // TODO:
safe: "0x79c740401f76b8a7b26baf3e522571add38362d0", // TODO:
splitMain: "0x5924cD81dC672151527B1E4b5Ef57B69cBD07Eda",
split: "0xccc8922d223f5bb2e623bf100970913ac85fd17d", // TODO:
pgRegistry: "0x7A69DbBFF504FAB98ADe857992BC6d1Ae94Ba0d0", // TODO:
domainId: 1936027759,
connext: "0x445fbf9cCbaf7d557fd771d56937E94397f43965",
moloch: "", // TODO:
safe: "", // TODO:
splitMain: "0x54E4a6014D36c381fC43b7E24A1492F556139a6F",
split: "", // TODO:
splitV2: "0x5e3058D49074b6Ce2419672BAFBCAfaA0835758d", // TODO:
splitV2Factory: defaultSplitsConfig.splitV2Factory,
pgRegistry: "", // TODO:
},
"11155420": {
// optimismSepolia
l2: true,
domainId: 0, // TODO:
connext: "", // TODO:
domainId: 1869640549,
connext: "0x8247ed6d0a344eeae4edBC7e44572F1B70ECA82A",
registryOwner: "0x10136Fa41B6522E4DBd068C6F7D80373aBbCFBe6", // TODO:
moloch: "",
safe: "",
splitMain: defaultSplitsConfig.splitMain,
splitMain: "0x2ed6c4B5dA6378c7897AC67Ba9e43102Feb694E",
split: "", // TODO:
splitV2: "", // TODO:
splitV2Factory: defaultSplitsConfig.splitV2Factory,
pgRegistry: "", // TODO:
},
"421614": {
// arbitrumSepolia
l2: true,
domainId: 0, // TODO:
connext: "", // TODO:
domainId: 1633842021,
connext: "0x1780Ac087Cbe84CA8feb75C0Fb61878971175eb8",
registryOwner: "0x10136Fa41B6522E4DBd068C6F7D80373aBbCFBe6", // TODO:
moloch: "",
safe: "",
splitMain: "", // TODO:
split: "", // TODO:
splitV2: "", // TODO:
splitV2Factory: defaultSplitsConfig.splitV2Factory,
pgRegistry: "", // TODO:
},
};
2 changes: 1 addition & 1 deletion constants/splits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export const PERCENTAGE_SCALE = BigNumber.from(1e6);

// Min & max distribution fee (0-10%)
export const MIN_DISTRIBUTION_FEE = BigNumber.from(0);
export const MAX_DISTRIBUTION_FEE = BigNumber.from(1e5);
export const MAX_DISTRIBUTION_FEE = BigNumber.from(2^16);
2 changes: 1 addition & 1 deletion deploy/003_deploy_PGRegistry_UUPS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, ethers, getChainId, getNamedAccounts, network } = hre;
const { deployer } = await getNamedAccounts();
const signer = await ethers.getSigner(deployer);
const chainId = network.name === "hardhat" ? "5" : await getChainId(); // hardhat -> Forking mode
const chainId = network.name === "hardhat" ? "11155111" : await getChainId(); // hardhat -> Forking mode

const { deploy } = deployments;

Expand Down
4 changes: 2 additions & 2 deletions deploy/004_deploy_PGNetworkRegistry_UUPS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { companionNetworks, deployments, ethers, getChainId, getNamedAccounts, network } = hre;
const { deployer } = await getNamedAccounts();
const signer = await ethers.getSigner(deployer);
const chainId = network.name === "hardhat" ? "5" : await getChainId(); // hardhat -> Forking mode
const chainId = network.name === "hardhat" ? "11155111" : await getChainId(); // hardhat -> Forking mode

const { deploy } = deployments;

Expand Down Expand Up @@ -79,7 +79,7 @@ const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {

return;
}
console.error("PGRegistry: Not supported Network!");
console.error("PGNetworkRegistry: Not supported Network!");
};

export default deployFn;
Expand Down
Loading

0 comments on commit d162382

Please sign in to comment.