Skip to content

Commit

Permalink
Merge pull request #133 from gnosis/sepolia
Browse files Browse the repository at this point in the history
Add Sepolia
  • Loading branch information
auryn-macmillan committed Aug 2, 2023
2 parents 202c097 + 76187d6 commit 90b8cb6
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 53 deletions.
3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
6 changes: 5 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (PK) {
}

if (
["mainnet", "goerli", "ropsten"].includes(network) &&
["mainnet", "goerli", "sepolia", "ropsten"].includes(network) &&
INFURA_KEY === undefined
) {
throw new Error(
Expand Down Expand Up @@ -77,6 +77,10 @@ export default {
...sharedNetworkConfig,
url: `https://goerli.infura.io/v3/${INFURA_KEY}`,
},
sepolia: {
...sharedNetworkConfig,
url: `https://sepolia.infura.io/v3/${INFURA_KEY}`,
},
arbitrum: {
...sharedNetworkConfig,
url: `https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`,
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gnosis.pm/zodiac",
"version": "3.3.6",
"version": "3.3.7",
"description": "Zodiac is a composable design philosophy and collection of standards for building DAO ecosystem tooling.",
"author": "Auryn Macmillan <[email protected]>",
"license": "LGPL-3.0+",
Expand All @@ -24,7 +24,8 @@
"build": "hardhat compile",
"build:sdk": "rm -rf dist && yarn generate:types && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json",
"clean": "rm -rf dist build typechain-types",
"deploy": "hardhat singleton-deployment --network",
"deploy:factory": "hardhat singleton-deployment --network",
"deploy": "hardhat deploy-replay --network",
"test:sdk": "hardhat test ./sdk/factory/__tests__/index.spec.ts",
"test": "hardhat test && yarn test:sdk",
"coverage": "hardhat coverage",
Expand Down
2 changes: 2 additions & 0 deletions sdk/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export enum SupportedNetworks {
BinanceSmartChain = 56,
HardhatNetwork = 31337,
LineaGoerli = 59140,
Sepolia = 11155111,
}

// const canonicalMasterCopyAddress = (contract: KnownContracts) => {
Expand Down Expand Up @@ -217,6 +218,7 @@ export const ContractVersions: Record<
},
},
[SupportedNetworks.LineaGoerli]: CanonicalAddresses,
[SupportedNetworks.Sepolia]: CanonicalAddresses,
};

/** Addresses of the head versions of all contracts */
Expand Down
4 changes: 2 additions & 2 deletions sdk/factory/deployModuleFactory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { constants as ethersConstants, ethers } from "ethers";
import { MasterCopyInitData } from "../contracts";
import { getSingletonFactory } from "./singletonFactory";
import { KnownContracts } from "./types";
import { MasterCopyInitData } from "../contracts";

const { AddressZero } = ethersConstants;

Expand Down Expand Up @@ -30,7 +30,7 @@ export const deployModuleFactory = async (
);
if (targetAddress === AddressZero) {
console.log(
" ✔ Module Proxy Factory already deployed to target address on this network."
` ✔ Module Proxy Factory already deployed to target address on ${signer.provider.network.name}.`
);
return AddressZero;
}
Expand Down
68 changes: 23 additions & 45 deletions tasks/deploy-replay.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import assert from "assert";
import { task } from "hardhat/config";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import {
Expand All @@ -12,55 +11,34 @@ interface InitData {
salt?: string;
}

export const deploy = async (
{ networks }: { networks: string[] },
hre: HardhatRuntimeEnvironment
) => {
export const deploy = async (_: unknown, hre: HardhatRuntimeEnvironment) => {
const contracts = Object.values(KnownContracts);
console.log(`\n\x1B[4m\x1B[1m${hre.network.name}\x1B[0m`);

const networkList = networks ? networks : Object.keys(hre.config.networks);
const [deployer] = await hre.ethers.getSigners();
const signer = hre.ethers.provider.getSigner(deployer.address);
for (let index = 0; index < contracts.length; index++) {
const initData: InitData | undefined = MasterCopyInitData[contracts[index]];

for (const network of networkList) {
console.log(`\n\x1B[4m\x1B[1m${network.toUpperCase()}\x1B[0m`);

try {
hre.changeNetwork(network);
const [deployer] = await hre.ethers.getSigners();
const signer = hre.ethers.provider.getSigner(deployer.address);
for (let index = 0; index < contracts.length; index++) {
const initData: InitData | undefined =
MasterCopyInitData[contracts[index]];

if (initData && initData.initCode && initData.salt) {
console.log(` \x1B[4m${contracts[index]}\x1B[0m`);
try {
await deployMastercopyWithInitData(
signer,
initData.initCode,
initData.salt
);
} catch (error: any) {
console.log(
` \x1B[31m✘ Deployment failed:\x1B[0m ${
error?.reason || error
}`
);
}
}
if (initData && initData.initCode && initData.salt) {
console.log(` \x1B[4m${contracts[index]}\x1B[0m`);
try {
await deployMastercopyWithInitData(
signer,
initData.initCode,
initData.salt
);
} catch (error: any) {
console.log(
` \x1B[31m✘ Deployment failed:\x1B[0m ${
error?.reason || error
}`
);
}
} catch (error: any) {
console.log(
` \x1B[31m✘ Network skipped because:\x1B[0m ${
error?.reason || error
}`
);
}
}
};

task(
"deploy-replay",
"Replay deployment of all mastercopies on network names provided as arguments. If no networks names are provided, the task will iterate through all networks defined in hardhat.config.ts"
)
.addOptionalVariadicPositionalParam("networks")
.setAction(deploy);
task("deploy-replay", "Replay deployment of all mastercopies").setAction(
deploy
);
4 changes: 2 additions & 2 deletions tasks/singleton-deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { deployModuleFactory } from "../sdk/factory/deployModuleFactory";

const FactoryInitCode = MasterCopyInitData[KnownContracts.FACTORY]?.initCode;

export const deploy = async (_: null, hre: HardhatRuntimeEnvironment) => {
export const deploy = async (_: unknown, hre: HardhatRuntimeEnvironment) => {
const Factory = await hre.ethers.getContractFactory("ModuleProxyFactory");
if (Factory.bytecode !== FactoryInitCode) {
console.warn(
" The compiled Module Proxy Factory (from src/factory/contracts.ts) is outdated, it does " +
" The compiled Module Proxy Factory is outdated, it does " +
"not match the bytecode stored at MasterCopyInitData[KnownContracts.FACTORY].initCode"
);
}
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5978,4 +5978,4 @@ yocto-queue@^0.1.0:
zksync-web3@^0.14.3:
version "0.14.3"
resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.14.3.tgz#64ac2a16d597464c3fc4ae07447a8007631c57c9"
integrity sha512-hT72th4AnqyLW1d5Jlv8N2B/qhEnl2NePK2A3org7tAa24niem/UAaHMkEvmWI3SF9waYUPtqAtjpf+yvQ9zvQ==
integrity sha512-hT72th4AnqyLW1d5Jlv8N2B/qhEnl2NePK2A3org7tAa24niem/UAaHMkEvmWI3SF9waYUPtqAtjpf+yvQ9zvQ==

0 comments on commit 90b8cb6

Please sign in to comment.