Crate stork_solana_sdk

Crate stork_solana_sdk 

Source
Expand description

stork logo

This is a Rust SDK to build Solana programs that consume Stork price feeds. This crate is maintained by Stork Labs.

A top level overview, as well as a small code sample, can be found in the libraries entry in crates.io.

§Pull Model

The 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 in order to do this.

§Stork Price Feed Accounts

On Solana, Stork price feeds exist as on-chain accounts. These accounts are instances of the 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 struct, which holds the quantized price, and a unix timestamp indicating when the price was created.

§Anchor

The Stork Solana SDK is built on top of Anchor, a framework for building Solana programs.

Modules§

error
Error codes for the Stork Solana SDK.
pda
Provides functions to get Program Derived Addresses (PDAs) for the Stork Solana SDK.
program
Provides the Stork program struct for implementing the anchor ID trait.
temporal_numeric_value
Provides the TemporalNumericValue and TemporalNumericValueFeed account structs. These structs are used to store the latest price update for an asset.

Constants§

ID_CONST
Const version of ID
PROGRAM_ID
The ID of the Stork Oracle program.

Statics§

ID
The static program ID

Functions§

check_id
Confirms that a given pubkey is equivalent to the program ID
id
Returns the program ID
id_const
Const version of ID