Skip to content

Commit e2ef99e

Browse files
authored
chore(pricefeed) Deploy morph mainnet (#2061)
* chore(pricefeed) Deploy morph mainnet * pre-commit * pnpm-lock update
1 parent f3b7cc4 commit e2ef99e

File tree

9 files changed

+438
-341
lines changed

9 files changed

+438
-341
lines changed

contract_manager/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@pythnetwork/contract-manager": "workspace:*",
3232
"@pythnetwork/cosmwasm-deploy-tools": "workspace:*",
3333
"@pythnetwork/entropy-sdk-solidity": "workspace:*",
34+
"@pythnetwork/hermes-client": "workspace:*",
3435
"@pythnetwork/price-service-client": "workspace:*",
3536
"@pythnetwork/pyth-fuel-js": "workspace:*",
3637
"@pythnetwork/pyth-sdk-solidity": "workspace:^",
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import yargs from "yargs";
2+
import { hideBin } from "yargs/helpers";
3+
import { HermesClient, PriceFeedMetadata } from "@pythnetwork/hermes-client";
4+
import { DefaultStore, toPrivateKey } from "../src";
5+
6+
const parser = yargs(hideBin(process.argv))
7+
.usage("Update the set of price feeds in a network. Usage: $0")
8+
.options({
9+
"private-key": {
10+
type: "string",
11+
demandOption: true,
12+
desc: "Private key to sign the transactions with",
13+
},
14+
contract: {
15+
type: "string",
16+
demandOption: true,
17+
desc: "Contract to update price feeds for (e.g mumbai_0xff1a0f4744e8582DF1aE09D5611b887B6a12925C)",
18+
},
19+
endpoint: {
20+
type: "string",
21+
desc: "Hermes endpoint to use, defaults to https://hermes.pyth.network",
22+
},
23+
});
24+
25+
// This script is intended to update all pricefeeds after we deploy pyth pricefeeds contract.
26+
// It will fetch all pricefeeds from hermes and update the pricefeeds contract with the new pricefeeds.
27+
async function main() {
28+
const argv = await parser.argv;
29+
let priceFeedsMetadata: PriceFeedMetadata[] = [];
30+
const client = new HermesClient(
31+
argv.endpoint || "https://hermes.pyth.network"
32+
);
33+
const contract = DefaultStore.contracts[argv.contract];
34+
const privateKey = toPrivateKey(argv["private-key"]);
35+
36+
priceFeedsMetadata = await client.getPriceFeeds();
37+
38+
const priceFeedIds = priceFeedsMetadata.map((feed) => feed.id);
39+
console.log(`Fetched ${priceFeedIds.length} price feed IDs`);
40+
41+
// We can adjust the chunk size based on the chain. Don't exceed 150 for now.
42+
// TODO: Add a check for the chain's block gas limit and adjust the chunk size accordingly.
43+
const chunkSize = 150;
44+
for (let i = 0; i < priceFeedIds.length; i += chunkSize) {
45+
const chunk = priceFeedIds.slice(i, i + chunkSize);
46+
console.log(`length: ${chunk.length}`);
47+
const updates = await client.getLatestPriceUpdates(chunk, {
48+
parsed: false,
49+
});
50+
console.log(
51+
await contract.executeUpdatePriceFeed(
52+
privateKey,
53+
updates.binary.data.map((update) => Buffer.from(update, "hex"))
54+
)
55+
);
56+
}
57+
}
58+
59+
main();

contract_manager/store/chains/EvmChains.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,3 +744,8 @@
744744
rpcUrl: https://nollie-rpc.skatechain.org
745745
networkId: 5051
746746
type: EvmChain
747+
- id: morph
748+
mainnet: true
749+
rpcUrl: https://rpc.morphl2.io
750+
networkId: 2818
751+
type: EvmChain

contract_manager/store/contracts/EvmPriceFeedContracts.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,3 +409,6 @@
409409
- chain: skate_testnet
410410
address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
411411
type: EvmPriceFeedContract
412+
- chain: morph
413+
address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
414+
type: EvmPriceFeedContract

contract_manager/store/contracts/EvmWormholeContracts.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,3 +406,6 @@
406406
- chain: skate_testnet
407407
address: "0xb27e5ca259702f209a29225d0eDdC131039C9933"
408408
type: EvmWormholeContract
409+
- chain: morph
410+
address: "0xb27e5ca259702f209a29225d0eDdC131039C9933"
411+
type: EvmWormholeContract

governance/xc_admin/packages/xc_admin_common/src/chains.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const RECEIVER_CHAINS = {
8989
flow_mainnet: 60062,
9090
sanko: 60063,
9191
skate: 60064,
92-
92+
morph: 60065,
9393
// Testnets as a separate chain ids (to use stable data sources and governance for them)
9494
injective_testnet: 60013,
9595
osmosis_testnet_4: 60015,

pnpm-lock.yaml

Lines changed: 364 additions & 339 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

target_chains/ethereum/sdk/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-evm-js",
3-
"version": "1.73.0",
3+
"version": "1.74.0",
44
"description": "Pyth Network EVM Utils in JS",
55
"homepage": "https://pyth.network",
66
"author": {

target_chains/ethereum/sdk/js/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const CONTRACT_ADDR: Record<string, string> = {
5252
merlin: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",
5353
meter: "0xbFe3f445653f2136b2FD1e6DdDb5676392E3AF16",
5454
mode: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",
55+
morph: "0x2880aB155794e7179c9eE2e38200202908C17B43",
5556
neon: "0x7f2dB085eFC3560AFF33865dD727225d91B4f9A5",
5657
opbnb: "0x2880aB155794e7179c9eE2e38200202908C17B43",
5758
optimism: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C",

0 commit comments

Comments
 (0)