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
Show file tree
Hide file tree
Changes from 6 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
Expand Up @@ -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"
15 changes: 15 additions & 0 deletions pyth-sdk/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use thiserror::Error;

#[derive(Error, Debug, Copy, Clone, PartialEq)]
pub enum LiquidityOracleError {
#[error("deposits exceeds max depositable")]
ExceedsMaxDeposits,
#[error("initial discount rate should not be greater than final discount rate")]
InitialDiscountExceedsFinalDiscount,
#[error("final discount rate should not be greater than the discount precision")]
FinalDiscountExceedsPrecision,
#[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
Expand Up @@ -8,6 +8,7 @@ use schemars::JsonSchema;
use std::fmt;

pub mod utils;
pub mod error;

mod price;
pub use price::Price;
Expand Down
Loading