Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(pricefeed) Deploy morph mainnet #2061

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contract_manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@pythnetwork/contract-manager": "workspace:*",
"@pythnetwork/cosmwasm-deploy-tools": "workspace:*",
"@pythnetwork/entropy-sdk-solidity": "workspace:*",
"@pythnetwork/hermes-client": "workspace:*",
"@pythnetwork/price-service-client": "workspace:*",
"@pythnetwork/pyth-fuel-js": "workspace:*",
"@pythnetwork/pyth-sdk-solidity": "workspace:^",
Expand Down
59 changes: 59 additions & 0 deletions contract_manager/scripts/update_all_pricefeeds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { HermesClient, PriceFeedMetadata } from "@pythnetwork/hermes-client";
import { DefaultStore, toPrivateKey } from "../src";

const parser = yargs(hideBin(process.argv))
.usage("Update the set of price feeds in a network. Usage: $0")
.options({
"private-key": {
type: "string",
demandOption: true,
desc: "Private key to sign the transactions with",
},
contract: {
type: "string",
demandOption: true,
desc: "Contract to update price feeds for (e.g mumbai_0xff1a0f4744e8582DF1aE09D5611b887B6a12925C)",
},
endpoint: {
type: "string",
desc: "Hermes endpoint to use, defaults to https://hermes.pyth.network",
},
});

// This script is intended to update all pricefeeds after we deploy pyth pricefeeds contract.
// It will fetch all pricefeeds from hermes and update the pricefeeds contract with the new pricefeeds.
async function main() {
const argv = await parser.argv;
let priceFeedsMetadata: PriceFeedMetadata[] = [];
const client = new HermesClient(
argv.endpoint || "https://hermes.pyth.network"
);
const contract = DefaultStore.contracts[argv.contract];
const privateKey = toPrivateKey(argv["private-key"]);

priceFeedsMetadata = await client.getPriceFeeds();

const priceFeedIds = priceFeedsMetadata.map((feed) => feed.id);
console.log(`Fetched ${priceFeedIds.length} price feed IDs`);

// We can adjust the chunk size based on the chain. Don't exceed 150 for now.
// TODO: Add a check for the chain's block gas limit and adjust the chunk size accordingly.
const chunkSize = 150;
for (let i = 0; i < priceFeedIds.length; i += chunkSize) {
const chunk = priceFeedIds.slice(i, i + chunkSize);
console.log(`length: ${chunk.length}`);
const updates = await client.getLatestPriceUpdates(chunk, {
parsed: false,
});
console.log(
await contract.executeUpdatePriceFeed(
privateKey,
updates.binary.data.map((update) => Buffer.from(update, "hex"))
)
);
}
}

main();
5 changes: 5 additions & 0 deletions contract_manager/store/chains/EvmChains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -744,3 +744,8 @@
rpcUrl: https://nollie-rpc.skatechain.org
networkId: 5051
type: EvmChain
- id: morph
mainnet: true
rpcUrl: https://rpc.morphl2.io
networkId: 2818
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 @@ -409,3 +409,6 @@
- chain: skate_testnet
address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
type: EvmPriceFeedContract
- chain: morph
address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
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 @@ -406,3 +406,6 @@
- chain: skate_testnet
address: "0xb27e5ca259702f209a29225d0eDdC131039C9933"
type: EvmWormholeContract
- chain: morph
address: "0xb27e5ca259702f209a29225d0eDdC131039C9933"
type: EvmWormholeContract
2 changes: 1 addition & 1 deletion governance/xc_admin/packages/xc_admin_common/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const RECEIVER_CHAINS = {
flow_mainnet: 60062,
sanko: 60063,
skate: 60064,

morph: 60065,
// Testnets as a separate chain ids (to use stable data sources and governance for them)
injective_testnet: 60013,
osmosis_testnet_4: 60015,
Expand Down
703 changes: 364 additions & 339 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

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.73.0",
"version": "1.74.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 @@ -52,6 +52,7 @@ export const CONTRACT_ADDR: Record<string, string> = {
merlin: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",
meter: "0xbFe3f445653f2136b2FD1e6DdDb5676392E3AF16",
mode: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",
morph: "0x2880aB155794e7179c9eE2e38200202908C17B43",
neon: "0x7f2dB085eFC3560AFF33865dD727225d91B4f9A5",
opbnb: "0x2880aB155794e7179c9eE2e38200202908C17B43",
optimism: "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C",
Expand Down
Loading