From 1c518d04e88c3d26fb612932365387aafd47be12 Mon Sep 17 00:00:00 2001 From: Andres Aiello Date: Mon, 18 Mar 2024 15:45:01 -0300 Subject: [PATCH] feat: deploy sc to sepolia --- lib/address.tools.ts | 2 ++ lib/contracts.constants.ts | 6 ++++++ lib/contracts.helpers.ts | 5 ++++- lib/types.ts | 1 + scripts/deployments/core/deploy.ts | 4 ++-- .../core/deterministic-deploy-erc20-custody.ts | 12 +++++++++++- .../core/deterministic-deploy-zeta-connector.ts | 10 +++++++++- .../core/deterministic-deploy-zeta-token.ts | 7 +++++-- 8 files changed, 40 insertions(+), 7 deletions(-) diff --git a/lib/address.tools.ts b/lib/address.tools.ts index d027c883..8d8aabe0 100644 --- a/lib/address.tools.ts +++ b/lib/address.tools.ts @@ -36,6 +36,7 @@ export declare type ZetaProtocolTestNetwork = | "btc_testnet" | "goerli_testnet" | "mumbai_testnet" + | "sepolia_testnet" | "zeta_testnet"; export const zetaProtocolTestNetworks: ZetaProtocolTestNetwork[] = [ @@ -43,6 +44,7 @@ export const zetaProtocolTestNetworks: ZetaProtocolTestNetwork[] = [ "bsc_testnet", "btc_testnet", "goerli_testnet", + "sepolia_testnet", "mumbai_testnet", "zeta_testnet", ]; diff --git a/lib/contracts.constants.ts b/lib/contracts.constants.ts index 9458905a..06b90cac 100644 --- a/lib/contracts.constants.ts +++ b/lib/contracts.constants.ts @@ -48,6 +48,12 @@ const SALT_NUMBERS = { zetaERC20Custody: "195084", zetaToken: "29265", }, + sepolia_testnet: { + zetaConnector: "1414", + zetaConsumer: "0", + zetaERC20Custody: "87967", + zetaToken: "84108", + }, zeta_testnet: { zetaConnector: "71733", zetaConsumer: "0", diff --git a/lib/contracts.helpers.ts b/lib/contracts.helpers.ts index 5508789b..e215e005 100644 --- a/lib/contracts.helpers.ts +++ b/lib/contracts.helpers.ts @@ -24,7 +24,10 @@ import { BaseContract, ContractFactory } from "ethers"; import { ethers } from "hardhat"; export const isEthNetworkName = (networkName: string) => - networkName === "eth-localnet" || networkName === "goerli_testnet" || networkName === "eth_mainnet"; + networkName === "eth-localnet" || + networkName === "goerli_testnet" || + networkName === "sepolia_testnet" || + networkName === "eth_mainnet"; export const deployZetaConnectorBase = async ({ args }: { args: Parameters }) => { const Factory = (await ethers.getContractFactory("ZetaConnectorBase")) as ZetaConnectorBaseFactory; diff --git a/lib/types.ts b/lib/types.ts index 6dbc5594..768209ea 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -19,6 +19,7 @@ export type ParamChainName = | "eth_mainnet" | "goerli_testnet" | "mumbai_testnet" + | "sepolia_testnet" | "zeta_mainnet" | "zeta_testnet"; export type ParamType = diff --git a/scripts/deployments/core/deploy.ts b/scripts/deployments/core/deploy.ts index eb3bc268..108c2771 100644 --- a/scripts/deployments/core/deploy.ts +++ b/scripts/deployments/core/deploy.ts @@ -10,8 +10,8 @@ const networkName = network.name; async function main() { if (!isProtocolNetworkName(networkName)) throw new Error("Invalid network name"); - await deterministicDeployZetaToken(); - await deterministicDeployZetaConnector(); + // await deterministicDeployZetaToken(); + // await deterministicDeployZetaConnector(); await deterministicDeployERC20Custody(); } diff --git a/scripts/deployments/core/deterministic-deploy-erc20-custody.ts b/scripts/deployments/core/deterministic-deploy-erc20-custody.ts index 370fc145..98209e0d 100644 --- a/scripts/deployments/core/deterministic-deploy-erc20-custody.ts +++ b/scripts/deployments/core/deterministic-deploy-erc20-custody.ts @@ -23,7 +23,7 @@ export const deterministicDeployERC20Custody = async () => { const zetaTokenAddress = getAddress("zetaToken", network.name); const tssAddress = getAddress("tss", network.name); const tssUpdaterAddress = getAddress("tssUpdater", network.name); - const immutableCreate2FactoryAddress = getAddress("immutableCreate2Factory", network.name); + const immutableCreate2FactoryAddress = "0x095a03c6a68137fE9a566bBc3e552F299d8b886d"; //getAddress("immutableCreate2Factory", network.name); const saltNumber = getSaltNumber("zetaERC20Custody", network.name); const saltStr = BigNumber.from(saltNumber).toHexString(); @@ -38,6 +38,16 @@ export const deterministicDeployERC20Custody = async () => { const constructorArgs = [tssAddress, tssUpdaterAddress, zetaFee.toString(), zetaMaxFee.toString(), zetaTokenAddress]; const contractBytecode = ERC20Custody__factory.bytecode; + // console.log("Deploying ERC20 Custody with the following parameters:"); + // console.log("tssAddress:", tssAddress); + // console.log("tssUpdaterAddress:", tssUpdaterAddress); + // console.log("zetaFee:", zetaFee.toString()); + // console.log("zetaMaxFee:", zetaMaxFee.toString()); + // console.log("zetaTokenAddress:", zetaTokenAddress); + // console.log("immutableCreate2FactoryAddress:", immutableCreate2FactoryAddress); + // console.log("salt:", salthex); + + // return; const { address } = await deployContractToAddress({ constructorArgs, constructorTypes, diff --git a/scripts/deployments/core/deterministic-deploy-zeta-connector.ts b/scripts/deployments/core/deterministic-deploy-zeta-connector.ts index dcb116db..97ff60e5 100644 --- a/scripts/deployments/core/deterministic-deploy-zeta-connector.ts +++ b/scripts/deployments/core/deterministic-deploy-zeta-connector.ts @@ -24,7 +24,7 @@ export const deterministicDeployZetaConnector = async () => { const zetaTokenAddress = getAddress("zetaToken", network.name); const tssAddress = getAddress("tss", network.name); const tssUpdaterAddress = getAddress("tssUpdater", network.name); - const immutableCreate2FactoryAddress = getAddress("immutableCreate2Factory", network.name); + const immutableCreate2FactoryAddress = "0x095a03c6a68137fE9a566bBc3e552F299d8b886d"; //getAddress("immutableCreate2Factory", network.name); const saltNumber = getSaltNumber("zetaConnector", network.name); const saltStr = BigNumber.from(saltNumber).toHexString(); @@ -33,6 +33,14 @@ export const deterministicDeployZetaConnector = async () => { const constructorTypes = ["address", "address", "address", "address"]; const constructorArgs = [zetaTokenAddress, tssAddress, tssUpdaterAddress, tssUpdaterAddress]; + console.log("Deploying ZetaConnector with the following parameters:"); + console.log("zetaTokenAddress:", zetaTokenAddress); + console.log("tssAddress:", tssAddress); + console.log("tssUpdaterAddress:", tssUpdaterAddress); + console.log("immutableCreate2FactoryAddress:", immutableCreate2FactoryAddress); + console.log("salt:", salthex); + + // return; let contractBytecode; if (isEthNetworkName(network.name)) { contractBytecode = ZetaConnectorEth__factory.bytecode; diff --git a/scripts/deployments/core/deterministic-deploy-zeta-token.ts b/scripts/deployments/core/deterministic-deploy-zeta-token.ts index 4ff01072..1abfdac3 100644 --- a/scripts/deployments/core/deterministic-deploy-zeta-token.ts +++ b/scripts/deployments/core/deterministic-deploy-zeta-token.ts @@ -19,11 +19,14 @@ export const deterministicDeployZetaToken = async () => { const [signer] = accounts; const initialBalance = await signer.getBalance(); + // console.log("signer:", signer.address); + // return; + const DEPLOYER_ADDRESS = process.env.DEPLOYER_ADDRESS || signer.address; const tssAddress = getAddress("tss", network.name); const tssUpdaterAddress = getAddress("tssUpdater", network.name); - const immutableCreate2FactoryAddress = getAddress("immutableCreate2Factory", network.name); + const immutableCreate2FactoryAddress = "0x095a03c6a68137fE9a566bBc3e552F299d8b886d"; //getAddress("immutableCreate2Factory", network.name); const saltNumber = getSaltNumber("zetaToken", network.name); const saltStr = BigNumber.from(saltNumber).toHexString(); @@ -59,7 +62,7 @@ export const deterministicDeployZetaToken = async () => { console.log("Constructor Args", constructorArgs); console.log("ETH spent:", initialBalance.sub(finalBalance).toString()); - return address; + return "address"; }; if (!process.env.EXECUTE_PROGRAMMATICALLY) {