Skip to content

Commit

Permalink
fix: zk deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
tHeMaskedMan981 committed Nov 20, 2024
1 parent bf35f4d commit 3820216
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 34 deletions.
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ const config: HardhatUserConfig = {
},
...liveNetworks,
zeroTestnet: {
url: "https://zerion-testnet-proofs.rpc.caldera.xyz/http",
url: process.env.ZERO_SEPOLIA_RPC,
zksync: true,
ethNetwork: "sepolia",
verifyURL:
Expand Down
4 changes: 0 additions & 4 deletions scripts/constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,11 @@ export const getProviderFromChainName = (chainName: HardhatChainName) => {
};

export const getZkWallet = (chainSlug: ChainSlug) => {
console.log({ chainSlug });
if (!zkStackChain.includes(chainSlug))
throw new Error(`Chain ${chainSlug} is not a zkStack chain`);
if (!process.env.SOCKET_SIGNER_KEY)
throw new Error("SOCKET_SIGNER_KEY not set");

const rpc = getJsonRpcUrl(chainSlug);
console.log({ rpc });
const provider = new Provider(rpc);
console.log({ provider });
return new zkWallet(process.env.SOCKET_SIGNER_KEY, provider);
};
47 changes: 24 additions & 23 deletions scripts/deploy/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ import { executionManagerVersion } from "./config/config";

const main = async () => {
try {
// const response = await prompts([
// {
// name: "chainType",
// type: "select",
// message: "Select chains network type",
// choices: [
// {
// title: "Mainnet",
// value: "mainnet",
// },
// {
// title: "Testnet",
// value: "testnet",
// },
// ],
// },
// ]);
const response = await prompts([
{
name: "chainType",
type: "select",
message: "Select chains network type",
choices: [
{
title: "Mainnet",
value: "mainnet",
},
{
title: "Testnet",
value: "testnet",
},
],
},
]);

// const chainOptions =
// response.chainType === "mainnet" ? MainnetIds : TestnetIds;
// let choices = chainOptions.map((chain) => ({
// title: chain.toString(),
// value: chain,
// }));
const chainOptions =
response.chainType === "mainnet" ? MainnetIds : TestnetIds;
let choices = chainOptions.map((chain) => ({
title: chain.toString(),
value: chain,
}));

const chainsResponse = await prompts([
{
Expand All @@ -56,6 +56,7 @@ const main = async () => {
const chains = chainsResponse.chains;
const siblings = chainsResponse.siblings;
const allChains = [...chains, ...siblings];
console.log("allChains: ", allChains);
let addresses: DeploymentAddresses = await deployForChains(
allChains,
executionManagerVersion
Expand Down
3 changes: 2 additions & 1 deletion scripts/deploy/scripts/configureSwitchboards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const configureSwitchboards = async (
executionManagerVersion: CORE_CONTRACTS
) => {
try {
console.log("=========== configuring switchboards ===========");
await Promise.all(
chains.map(async (chain) => {
if (!addresses[chain]) return;
Expand Down Expand Up @@ -64,7 +65,7 @@ export const configureSwitchboards = async (
siblings.includes(parseInt(chain) as ChainSlug)
);

console.log(`Configuring for ${chain}`);
console.log(`Configuring switchboards for ${chain}`);

for (let sibling of integrationList) {
const nativeConfig = integrations[sibling][IntegrationTypes.native];
Expand Down
3 changes: 2 additions & 1 deletion scripts/deploy/scripts/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const connectPlugs = async (
siblings: ChainSlug[]
) => {
try {
console.log("=========== connecting plugs ===========");
await Promise.all(
chains.map(async (chain) => {
if (!addresses[chain]) return;
Expand Down Expand Up @@ -49,7 +50,7 @@ export const connectPlugs = async (
}
);

console.log(`Configuring for ${chain}`);
console.log(`Connecting Counter for ${chain}`);

const counter: Contract = (
await getInstance("Counter", addr["Counter"])
Expand Down
1 change: 1 addition & 0 deletions scripts/deploy/scripts/deploySocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export const deploySocket = async (
switchboardSimulator.address;

// setup
console.log("starting setup : ", chainSlug);
const simulatorContract = (
await getInstance("SocketSimulator", socketSimulator.address)
).connect(deployUtils.signer);
Expand Down
12 changes: 8 additions & 4 deletions scripts/deploy/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,13 @@ export async function deployContractWithArgs(
});
const contract = await deployer.deploy(artifact, args);
const address = await contract.getAddress();
const Contract: ContractFactory = await ethers.getContractFactory(
const contractFactory: ContractFactory = await ethers.getContractFactory(
contractName
);
// console.log(contract);
// contract.address = address;
return Contract.attach(address);
const instance = contractFactory.attach(address);
return { ...instance, address };
} else {
const Contract: ContractFactory = await ethers.getContractFactory(
contractName
Expand Down Expand Up @@ -182,8 +183,11 @@ export const verify = async (
export const getInstance = async (
contractName: string,
address: Address
): Promise<Contract> =>
(await ethers.getContractFactory(contractName)).attach(address);
): Promise<Contract> => {
const artifact = await hre.artifacts.readArtifact(contractName);
const c = new Contract(address, artifact.abi);
return c;
};

export const getChainSlug = async (): Promise<number> => {
if (network.config.chainId === undefined)
Expand Down

0 comments on commit 3820216

Please sign in to comment.