Bläddra i källkod

(chore:pricefeed) deploy cronos zkevm (#1790)

* wip-temp

* d

* deployed cronos-zkevm
Aditya Arora 1 år sedan
förälder
incheckning
7bd214e658

+ 3 - 3
contract_manager/scripts/sync_wormhole_guardian_set.ts

@@ -68,9 +68,9 @@ async function main() {
 
         // TODO: This is a temporary workaround to skip contracts that are in beta channel
         // We should have a better way to handle this
-        if ((await wormhole.getCurrentGuardianSetIndex()) === 0) {
-          continue;
-        }
+        // if ((await wormhole.getCurrentGuardianSetIndex()) === 0) {
+        //   continue;
+        // }
 
         console.log(
           `Current Guardianset for ${contract.getId()}: ${await wormhole.getCurrentGuardianSetIndex()}`

+ 5 - 0
contract_manager/store/chains/EvmChains.yaml

@@ -669,3 +669,8 @@
   rpcUrl: https://rpc.kinto-rpc.com
   networkId: 7887
   type: EvmChain
+- id: cronos_zkevm_testnet
+  mainnet: false
+  rpcUrl: https://testnet.zkevm.cronos.org
+  networkId: 282
+  type: EvmChain

+ 3 - 0
contract_manager/store/contracts/EvmPriceFeedContracts.yaml

@@ -373,3 +373,6 @@
 - chain: kinto
   address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
   type: EvmPriceFeedContract
+- chain: cronos_zkevm_testnet
+  address: "0x67DFF3D12dFDCeC9f85fd86f4cBDb0a111fF721A"
+  type: EvmPriceFeedContract

+ 3 - 0
contract_manager/store/contracts/EvmWormholeContracts.yaml

@@ -358,3 +358,6 @@
 - chain: kinto
   address: "0xb27e5ca259702f209a29225d0eDdC131039C9933"
   type: EvmWormholeContract
+- chain: cronos_zkevm_testnet
+  address: "0x3f5bB93eEC6E3D6784274291A5816Bc34E851dc8"
+  type: EvmWormholeContract

+ 1 - 0
governance/xc_admin/packages/xc_admin_common/src/chains.ts

@@ -172,6 +172,7 @@ export const RECEIVER_CHAINS = {
   tabi_testnet: 50088,
   movement_suzuka_testnet: 50089,
   b3_testnet: 50090,
+  cronos_zkevm_testnet: 50091,
 };
 
 // If there is any overlapping value the receiver chain will replace the wormhole

+ 24 - 23
target_chains/ethereum/contracts/deploy/zkSyncDeploy.ts

@@ -86,9 +86,8 @@ export default async function (hre: HardhatRuntimeEnvironment) {
     `Deployed WormholeReceiver on ${wormholeReceiverContract.address}`
   );
 
-  const governanceInitialSequence = Number(
-    process.env.GOVERNANCE_INITIAL_SEQUENCE ?? "0"
-  );
+  // Hardcoding the initial sequence number for governance messages.
+  const governanceInitialSequence = Number("0");
 
   const validTimePeriodSeconds = Number(envOrErr("VALID_TIME_PERIOD_SECONDS"));
   const singleUpdateFeeInWei = Number(envOrErr("SINGLE_UPDATE_FEE_IN_WEI"));
@@ -98,6 +97,8 @@ export default async function (hre: HardhatRuntimeEnvironment) {
 
   const pythImplContract = await deployer.deploy(pythImplArtifact);
 
+  console.log(`Deployed Pyth implementation on ${pythImplContract.address}`);
+
   const pythInitData = pythImplContract.interface.encodeFunctionData(
     "initialize",
     [
@@ -119,24 +120,24 @@ export default async function (hre: HardhatRuntimeEnvironment) {
 
   console.log(`Deployed Pyth contract on ${pythProxyContract.address}`);
 
-  const networkId = hre.network.config.chainId;
-  const registryPath = `networks/${networkId}.json`;
-  console.log(`Saving addresses in ${registryPath}`);
-  writeFileSync(
-    registryPath,
-    JSON.stringify(
-      [
-        {
-          contractName: "WormholeReceiver",
-          address: wormholeReceiverContract.address,
-        },
-        {
-          contractName: "PythUpgradable",
-          address: pythProxyContract.address,
-        },
-      ],
-      null,
-      2
-    )
-  );
+  //   const networkId = hre.network.config.chainId;
+  //   const registryPath = `networks/${networkId}.json`;
+  //   console.log(`Saving addresses in ${registryPath}`);
+  //   writeFileSync(
+  //     registryPath,
+  //     JSON.stringify(
+  //       [
+  //         {
+  //           contractName: "WormholeReceiver",
+  //           address: wormholeReceiverContract.address,
+  //         },
+  //         {
+  //           contractName: "PythUpgradable",
+  //           address: pythProxyContract.address,
+  //         },
+  //       ],
+  //       null,
+  //       2
+  //     )
+  //   );
 }

+ 8 - 2
target_chains/ethereum/contracts/hardhat.config.ts

@@ -6,7 +6,7 @@ import "@matterlabs/hardhat-zksync-solc";
 
 module.exports = {
   zksolc: {
-    version: "1.3.1",
+    version: "1.4.1",
     compilerSource: "binary",
     settings: {
       optimizer: {
@@ -14,7 +14,7 @@ module.exports = {
       },
     },
   },
-  defaultNetwork: "zkSyncTestnet",
+  defaultNetwork: "cronosZkEvmTestnet",
   networks: {
     [process.env.MIGRATIONS_NETWORK!]: {
       url: process.env.RPC_URL,
@@ -43,6 +43,12 @@ module.exports = {
       verifyURL:
         "https://zksync2-mainnet-explorer.zksync.io/contract_verification",
     },
+    cronosZkEvmTestnet: {
+      url: "https://testnet.zkevm.cronos.org",
+      ethNetwork: "sepolia", // or a Sepolia RPC endpoint from Infura/Alchemy/Chainstack etc.
+      zksync: true,
+      verifyURL: "https://explorer.zkevm.cronos.org/contract_verification",
+    },
     neon_devnet: {
       url: "https://devnet.neonevm.org",
       chainId: 245022926,

+ 59 - 0
target_chains/ethereum/contracts/scripts/contractManagerConfig.js

@@ -0,0 +1,59 @@
+const {
+  EvmContract,
+  DefaultStore,
+  Store,
+  getDefaultDeploymentConfig,
+} = require("@pythnetwork/contract-manager");
+
+function convertAddress(address) {
+  return "0x" + address;
+}
+
+function convertChainId(number) {
+  return "0x" + number.toString(16);
+}
+
+function getDefaultConfig(chainName) {
+  const chain = DefaultStore.chains[chainName];
+  console.log("***chain", chain);
+  const { dataSources, governanceDataSource, wormholeConfig } =
+    getDefaultDeploymentConfig("stable");
+
+  const emitterChainIds = dataSources.map((dataSource) =>
+    convertChainId(dataSource.emitterChain)
+  );
+  const emitterAddresses = dataSources.map((dataSource) =>
+    convertAddress(dataSource.emitterAddress)
+  );
+  const governanceChainId = convertChainId(governanceDataSource.emitterChain);
+  const governanceEmitter = convertAddress(governanceDataSource.emitterAddress);
+
+  const wormholeInitialSigners =
+    wormholeConfig.initialGuardianSet.map(convertAddress);
+  const wormholeGovernanceChainId = convertChainId(
+    wormholeConfig.governanceChainId
+  );
+  const wormholeGovernanceContract = convertAddress(
+    wormholeConfig.governanceContract
+  );
+
+  return {
+    governanceEmitter,
+    governanceChainId,
+    emitterAddresses,
+    emitterChainIds,
+    wormholeInitialSigners,
+    wormholeGovernanceChainId,
+    wormholeGovernanceContract,
+  };
+}
+function saveConfig(chainName, address) {
+  const chain = DefaultStore.chains[chainName];
+  const contract = new EvmContract(chain, address);
+  DefaultStore.contracts[contract.getId()] = contract;
+  DefaultStore.saveAllContracts();
+  console.log("Added the following to your evm contract configs");
+  console.log(Store.serialize(contract));
+}
+
+module.exports = { saveConfig, getDefaultConfig };

+ 1 - 1
target_chains/ethereum/sdk/js/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@pythnetwork/pyth-evm-js",
-  "version": "1.58.0",
+  "version": "1.59.0",
   "description": "Pyth Network EVM Utils in JS",
   "homepage": "https://pyth.network",
   "author": {

+ 1 - 0
target_chains/ethereum/sdk/js/src/index.ts

@@ -86,6 +86,7 @@ export const CONTRACT_ADDR: Record<string, string> = {
   conflux_espace_testnet: "0xDd24F84d36BF92C65F92307595335bdFab5Bbd21",
   core_dao_testnet: "0x8D254a21b3C86D32F7179855531CE99164721933",
   cronos_testnet: "0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320",
+  cronos_zkevm_testnet: "0x67DFF3D12dFDCeC9f85fd86f4cBDb0a111fF721A",
   dela_deperp_testnet: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",
   dela_mithreum_deperp_testnet: "0xe9d69CdD6Fe41e7B621B4A688C5D1a68cB5c8ADc",
   etherlink_testnet: "0x2880aB155794e7179c9eE2e38200202908C17B43",