Skip to content

Commit

Permalink
feat: deploy sc to sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
andresaiello committed Mar 18, 2024
1 parent 5b9717f commit 1c518d0
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 7 deletions.
2 changes: 2 additions & 0 deletions lib/address.tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ export declare type ZetaProtocolTestNetwork =
| "btc_testnet"
| "goerli_testnet"
| "mumbai_testnet"
| "sepolia_testnet"
| "zeta_testnet";

export const zetaProtocolTestNetworks: ZetaProtocolTestNetwork[] = [
"baobab_testnet",
"bsc_testnet",
"btc_testnet",
"goerli_testnet",
"sepolia_testnet",
"mumbai_testnet",
"zeta_testnet",
];
Expand Down
6 changes: 6 additions & 0 deletions lib/contracts.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion lib/contracts.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ZetaConnectorBaseFactory["deploy"]> }) => {
const Factory = (await ethers.getContractFactory("ZetaConnectorBase")) as ZetaConnectorBaseFactory;
Expand Down
1 change: 1 addition & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type ParamChainName =
| "eth_mainnet"
| "goerli_testnet"
| "mumbai_testnet"
| "sepolia_testnet"
| "zeta_mainnet"
| "zeta_testnet";
export type ParamType =
Expand Down
4 changes: 2 additions & 2 deletions scripts/deployments/core/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
12 changes: 11 additions & 1 deletion scripts/deployments/core/deterministic-deploy-erc20-custody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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,
Expand Down
10 changes: 9 additions & 1 deletion scripts/deployments/core/deterministic-deploy-zeta-connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand Down
7 changes: 5 additions & 2 deletions scripts/deployments/core/deterministic-deploy-zeta-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 1c518d0

Please sign in to comment.