Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: zk deploy #406

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading