Skip to content

Commit

Permalink
(chore:pricefeed) deploy cronos zkevm (#1790)
Browse files Browse the repository at this point in the history
* wip-temp

* d

* deployed cronos-zkevm
  • Loading branch information
aditya520 committed Jul 23, 2024
1 parent 6bc6682 commit 7bd214e
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 29 deletions.
6 changes: 3 additions & 3 deletions contract_manager/scripts/sync_wormhole_guardian_set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`
Expand Down
5 changes: 5 additions & 0 deletions contract_manager/store/chains/EvmChains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 3 additions & 0 deletions contract_manager/store/contracts/EvmPriceFeedContracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,6 @@
- chain: kinto
address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
type: EvmPriceFeedContract
- chain: cronos_zkevm_testnet
address: "0x67DFF3D12dFDCeC9f85fd86f4cBDb0a111fF721A"
type: EvmPriceFeedContract
3 changes: 3 additions & 0 deletions contract_manager/store/contracts/EvmWormholeContracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,6 @@
- chain: kinto
address: "0xb27e5ca259702f209a29225d0eDdC131039C9933"
type: EvmWormholeContract
- chain: cronos_zkevm_testnet
address: "0x3f5bB93eEC6E3D6784274291A5816Bc34E851dc8"
type: EvmWormholeContract
1 change: 1 addition & 0 deletions governance/xc_admin/packages/xc_admin_common/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
47 changes: 24 additions & 23 deletions target_chains/ethereum/contracts/deploy/zkSyncDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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",
[
Expand All @@ -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
// )
// );
}
10 changes: 8 additions & 2 deletions target_chains/ethereum/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import "@matterlabs/hardhat-zksync-solc";

module.exports = {
zksolc: {
version: "1.3.1",
version: "1.4.1",
compilerSource: "binary",
settings: {
optimizer: {
enabled: true,
},
},
},
defaultNetwork: "zkSyncTestnet",
defaultNetwork: "cronosZkEvmTestnet",
networks: {
[process.env.MIGRATIONS_NETWORK!]: {
url: process.env.RPC_URL,
Expand Down Expand Up @@ -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,
Expand Down
59 changes: 59 additions & 0 deletions target_chains/ethereum/contracts/scripts/contractManagerConfig.js
Original file line number Diff line number Diff line change
@@ -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 };
2 changes: 1 addition & 1 deletion target_chains/ethereum/sdk/js/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
1 change: 1 addition & 0 deletions target_chains/ethereum/sdk/js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 7bd214e

Please sign in to comment.