Integration of pyth with solana smart contracts ,demonstrating use of on chain price fetch
This repo demonstrates fetching price on chain as well as using client side code to use that contract
https://github.com/pyth-network/pyth-crosschain.git
In src/Cargo.toml add
[dependencies]
anchor-lang = "0.30.1"
pyth-solana-receiver-sdk = {path="/PATH_TO/pyth_solana_receiver_sdk"}
anchor build
anchor deploy
Testing the client script is coded in tests folder
npm install rpc-websockets
anchor run test
You can query any token price wirh just pyth feed id https://pyth.network/developers/price-feed-ids
Tested it with BTC/USD when it was aroung $58K
If you benefitted from the project, show us some support by giving us a star ⭐. Open source is awesome!
https://docs.pyth.network/price-feeds/use-real-time-data/solana