Skip to content

Commit e61f976

Browse files
committed
Merge branch 'main' of github.com:pyth-network/pyth-crosschain into tb/solana-receiver-js-sdk/post-twap-updates
2 parents 8458dc4 + 6b611c8 commit e61f976

File tree

25 files changed

+622
-130
lines changed

25 files changed

+622
-130
lines changed

apps/price_pusher/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ You can get the list of available price feeds from
7575

7676
Price pusher communicates with [Hermes][] price service to get the most recent price updates. Hermes listens to the
7777
Pythnet and Wormhole network to get latest price updates, and serves REST and websocket APIs for consumers to fetch the
78-
updates. Pyth hosts public endpoints for Hermes; however, it is recommended to get a private endpoint from one of the
78+
updates.
79+
80+
NOTE: It is recommended to use stable hermes endpoints. If you are running the price pusher for **Aptos Testnet**, **Sui Testnet**, or **Near Testnet**, we recommend you use beta hermes endpoints.
81+
82+
Pyth hosts [public endpoints](https://docs.pyth.network/price-feeds/api-instances-and-providers/hermes) for Hermes; however, it is recommended to get a private endpoint from one of the
7983
Hermes RPC providers for more reliability. Please refer to [this
8084
document](https://docs.pyth.network/documentation/pythnet-price-feeds/hermes) for more information.
8185

contract_manager/store/chains/EvmChains.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,3 +815,28 @@
815815
rpcUrl: https://rpc.soniclabs.com
816816
networkId: 146
817817
type: EvmChain
818+
# - id: bittensor
819+
# mainnet: true
820+
# rpcUrl: https://entrypoint-finney.opentensor.ai:443
821+
# networkId: 945
822+
# type: EvmChain
823+
# - id: bittensor_testnet
824+
# mainnet: false
825+
# rpcUrl: https://test.finney.opentensor.ai:443
826+
# networkId: 945
827+
# type: EvmChain
828+
- id: threat_level_midnight
829+
mainnet: true
830+
rpcUrl: $ENV_THREAT_LEVEL_MIDNIGHT_RPC_URL
831+
networkId: 1868
832+
type: EvmChain
833+
- id: story_testnet
834+
mainnet: false
835+
rpcUrl: https://rpc.odyssey.storyrpc.io/
836+
networkId: 1516
837+
type: EvmChain
838+
- id: eventum_mainnet
839+
mainnet: true
840+
rpcUrl: https://mainnet-rpc.evedex.com
841+
networkId: 161803
842+
type: EvmChain

contract_manager/store/contracts/EvmEntropyContracts.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,6 @@
133133
- chain: fantom_sonic_mainnet
134134
address: "0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320"
135135
type: EvmEntropyContract
136+
- chain: tabi_testnet
137+
address: "0xEbe57e8045F2F230872523bbff7374986E45C486"
138+
type: EvmEntropyContract

contract_manager/store/contracts/EvmPriceFeedContracts.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,3 +454,12 @@
454454
- chain: fantom_sonic_mainnet
455455
address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
456456
type: EvmPriceFeedContract
457+
- chain: eventum_mainnet
458+
address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
459+
type: EvmPriceFeedContract
460+
- chain: threat_level_midnight
461+
address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
462+
type: EvmPriceFeedContract
463+
- chain: story_testnet
464+
address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
465+
type: EvmPriceFeedContract

contract_manager/store/contracts/EvmWormholeContracts.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,12 @@
448448
- chain: fantom_sonic_mainnet
449449
address: "0xb27e5ca259702f209a29225d0eDdC131039C9933"
450450
type: EvmWormholeContract
451+
- chain: eventum_mainnet
452+
address: "0xb27e5ca259702f209a29225d0eDdC131039C9933"
453+
type: EvmWormholeContract
454+
- chain: threat_level_midnight
455+
address: "0xb27e5ca259702f209a29225d0eDdC131039C9933"
456+
type: EvmWormholeContract
457+
- chain: story_testnet
458+
address: "0xb27e5ca259702f209a29225d0eDdC131039C9933"
459+
type: EvmWormholeContract

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ export const RECEIVER_CHAINS = {
9999
horse_dream: 60070,
100100
mathematician_in_heart: 60071,
101101
fantom_sonic_mainnet: 60072,
102-
102+
eventum_mainnet: 60073,
103+
threat_level_midnight: 60074,
103104
// Testnets as a separate chain ids (to use stable data sources and governance for them)
104105
injective_testnet: 60013,
105106
osmosis_testnet_4: 60015,
@@ -218,6 +219,7 @@ export const RECEIVER_CHAINS = {
218219
eventum_testnet: 50110,
219220
fantom_sonic_devnet: 50111,
220221
movement_bardock_testnet: 50112,
222+
story_testnet: 50113,
221223
};
222224

223225
// If there is any overlapping value the receiver chain will replace the wormhole

lazer/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lazer/contracts/solana/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"test:format": "prettier --check **/*.*",
88
"test:anchor": "CARGO_TARGET_DIR=\"$PWD/target\" anchor test",
99
"test": "pnpm run test:format && pnpm run test:anchor",
10-
"setup": "anchor build && pnpm ts-node scripts/setup.ts"
10+
"setup": "anchor build && pnpm ts-node scripts/setup.ts",
11+
"migrate_from_0_1_0": "pnpm ts-node scripts/migrate_from_0_1_0.ts"
1112
},
1213
"dependencies": {
1314
"@coral-xyz/anchor": "^0.30.1"

lazer/contracts/solana/programs/pyth-lazer-solana-contract/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ no-log-ix-name = []
1919
idl-build = ["anchor-lang/idl-build"]
2020

2121
[dependencies]
22-
pyth-lazer-protocol = { version = "0.1.0", path = "../../../../sdk/rust/protocol" }
22+
pyth-lazer-protocol = { version = "0.1.2", path = "../../../../sdk/rust/protocol" }
2323

2424
anchor-lang = "0.30.1"
2525
bytemuck = "1.20.0"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import * as anchor from "@coral-xyz/anchor";
2+
import { Program } from "@coral-xyz/anchor";
3+
import { PythLazerSolanaContract } from "../target/types/pyth_lazer_solana_contract";
4+
import * as pythLazerSolanaContractIdl from "../target/idl/pyth_lazer_solana_contract.json";
5+
import yargs from "yargs/yargs";
6+
import { readFileSync } from "fs";
7+
import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet";
8+
9+
// This script tops up the storage PDA and calls `migrateFrom010` on the contract.
10+
async function main() {
11+
let argv = await yargs(process.argv.slice(2))
12+
.options({
13+
url: { type: "string", demandOption: true },
14+
"keypair-path": { type: "string", demandOption: true },
15+
treasury: { type: "string", demandOption: true },
16+
})
17+
.parse();
18+
19+
const keypair = anchor.web3.Keypair.fromSecretKey(
20+
new Uint8Array(JSON.parse(readFileSync(argv.keypairPath, "ascii")))
21+
);
22+
const wallet = new NodeWallet(keypair);
23+
const connection = new anchor.web3.Connection(argv.url, {
24+
commitment: "confirmed",
25+
});
26+
const provider = new anchor.AnchorProvider(connection, wallet);
27+
28+
const program: Program<PythLazerSolanaContract> = new Program(
29+
pythLazerSolanaContractIdl as PythLazerSolanaContract,
30+
provider
31+
);
32+
33+
const storagePdaKey = new anchor.web3.PublicKey(
34+
"3rdJbqfnagQ4yx9HXJViD4zc4xpiSqmFsKpPuSCQVyQL"
35+
);
36+
const storagePdaInfo = await provider.connection.getAccountInfo(
37+
storagePdaKey
38+
);
39+
const newStorageSize = 381;
40+
if (storagePdaInfo.data.length == newStorageSize) {
41+
console.log("Already migrated");
42+
const storage = await program.account.storage.all();
43+
console.log("storage account: ", storage);
44+
return;
45+
}
46+
const minBalance =
47+
await provider.connection.getMinimumBalanceForRentExemption(newStorageSize);
48+
if (storagePdaInfo.lamports < minBalance) {
49+
console.log("storage PDA needs top-up");
50+
const transaction = new anchor.web3.Transaction().add(
51+
anchor.web3.SystemProgram.transfer({
52+
fromPubkey: keypair.publicKey,
53+
toPubkey: storagePdaKey,
54+
lamports: minBalance - storagePdaInfo.lamports,
55+
})
56+
);
57+
const signature = await anchor.web3.sendAndConfirmTransaction(
58+
provider.connection,
59+
transaction,
60+
[keypair]
61+
);
62+
console.log("signature:", signature);
63+
} else {
64+
console.log("storage PDA doesn't need top-up");
65+
}
66+
67+
console.log("executing migration");
68+
const signature2 = await program.methods
69+
.migrateFrom010(new anchor.web3.PublicKey(argv.treasury))
70+
.accounts({})
71+
.rpc();
72+
console.log("signature:", signature2);
73+
}
74+
75+
main();

0 commit comments

Comments
 (0)