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

Liquidity oracle #98

Merged
merged 19 commits into from
Feb 3, 2023
Merged
Changes from 7 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 pyth-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ borsh = "0.9"
borsh-derive = "0.9.0"
serde = { version = "1.0.136", features = ["derive"] }
schemars = "0.8.8"
thiserror = "1.0.24"

[dev-dependencies]
serde_json = "1.0.79"
17 changes: 17 additions & 0 deletions pyth-sdk/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use thiserror::Error;

#[derive(Error, Debug, Copy, Clone, PartialEq)]
pub enum OracleError {
#[error("initial endpoint should not be greater than or equal to final endpoint")]
InitialEndpointExceedsFinalEndpoint,
#[error("initial discount should not exceed final discount, for collateral valuation")]
InitialDiscountExceedsFinalDiscount,
#[error("final discount rate should not be greater than the discount precision")]
FinalDiscountExceedsPrecision,
#[error("initial premium should not exceed final premium, for borrow valuation")]
InitialPremiumExceedsFinalPremium,
#[error("None encountered")]
NoneEncountered,
#[error("i64 try from error")]
I64ConversionError,
}
1 change: 1 addition & 0 deletions pyth-sdk/src/lib.rs
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ use schemars::JsonSchema;
use std::fmt;

pub mod utils;
pub mod error;

mod price;
pub use price::Price;
Loading