stork_solana_sdk/lib.rs
1/*! [](https://stork.network)
2
3This is a Rust SDK to build Solana programs that consume Stork price feeds. This crate is maintained by [Stork Labs](https://stork.network).
4
5A top level overview, as well as a small code sample, can be found in [the libraries entry in crates.io](https://crates.io/crates/stork-solana-sdk).
6
7# Pull Model
8
9The Stork Solana SDK allows users to consume Stork price updates on a pull basis. This puts the responsibility of submitting the price updates on-chain to the user whenever they want to interact with an app that consumes Stork price feeds. Stork Labs maintains a [Chain Pusher](https://github.com/stork-oracle/stork-external/tree/main/apps/chain_pusher/README.md) in order to do this.
10
11# Stork Price Feed Accounts
12
13On Solana, Stork price feeds exist as on-chain accounts. These accounts are instances of the [TemporalNumericValueFeed](temporal_numeric_value::TemporalNumericValueFeed) account struct, and are created and owned by the Stork Oracle contract. These account have an ID which associates them with a specific asset, and a `latest_value` field which stores the latest price update. The ID of a TemporalNumericValueFeed account is determined by taking the keccak256 hash of the asset ID. The `latest_value` field is an instance of the [TemporalNumericValue](temporal_numeric_value::TemporalNumericValue) struct, which holds the quantized price, and a unix timestamp indicating when the price was created.
14
15# Anchor
16
17The Stork Solana SDK is built on top of [Anchor](https://github.com/coral-xyz/anchor), a framework for building Solana programs.
18
19*/
20use anchor_lang::{declare_id, prelude::Pubkey, pubkey};
21
22pub mod error;
23pub mod pda;
24pub mod program;
25pub mod temporal_numeric_value;
26
27/// The ID of the Stork Oracle program.
28pub const PROGRAM_ID: Pubkey = pubkey!("stork1JUZMKYgjNagHiK2KdMmb42iTnYe9bYUCDUk8n");
29declare_id!(PROGRAM_ID);