Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion core/src/quote/liquidity/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub type AddLiqQuoteResult<I, P> = Result<AddLiqQuote, AddLiqQuoteErr<I, P>>;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum AddLiqQuoteErr<I, P> {
InpCalc(I),
InpDisabled,
Overflow,
Pricing(P),
ZeroValue,
Expand All @@ -62,9 +63,10 @@ impl<S: Display, P: Display> Display for AddLiqQuoteErr<S, P> {
#[inline]
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::InpCalc(e) => e.fmt(f),
Self::InpDisabled => f.write_str("LST input disabled"),
Self::Overflow => f.write_str("arithmetic overflow"),
Self::Pricing(e) => e.fmt(f),
Self::InpCalc(e) => e.fmt(f),
Self::ZeroValue => f.write_str("zero value"),
}
}
Expand Down
8 changes: 5 additions & 3 deletions core/src/quote/swap/err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ use crate::err::NotEnoughLiquidityErr;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum SwapQuoteErr<I, O, P> {
InpCalc(I),
InpDisabled,
NotEnoughLiquidity(NotEnoughLiquidityErr),
OutCalc(O),
Overflow,
NotEnoughLiquidity(NotEnoughLiquidityErr),
Pricing(P),
ZeroValue,
}
Expand All @@ -16,11 +17,12 @@ impl<I: Display, O: Display, P: Display> Display for SwapQuoteErr<I, O, P> {
#[inline]
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::InpDisabled => f.write_str("LST input disabled"),
Self::InpCalc(e) => e.fmt(f),
Self::NotEnoughLiquidity(e) => e.fmt(f),
Self::OutCalc(e) => e.fmt(f),
Self::Overflow => f.write_str("arithmetic overflow"),
Self::NotEnoughLiquidity(e) => e.fmt(f),
Self::Pricing(e) => e.fmt(f),
Self::InpCalc(e) => e.fmt(f),
Self::ZeroValue => f.write_str("zero value"),
}
}
Expand Down
12 changes: 8 additions & 4 deletions jiminy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ impl<
sol_log(&msg);
match e {
SwapQuoteErr::InpCalc(e) => e.into(),
SwapQuoteErr::OutCalc(e) => e.into(),
SwapQuoteErr::Overflow => Inf1CtlCustomProgErr(Inf1CtlErr::MathError).into(),
SwapQuoteErr::InpDisabled => Inf1CtlCustomProgErr(Inf1CtlErr::LstInputDisabled).into(),
SwapQuoteErr::NotEnoughLiquidity(_) => {
Inf1CtlCustomProgErr(Inf1CtlErr::NotEnoughLiquidity).into()
}
SwapQuoteErr::OutCalc(e) => e.into(),
SwapQuoteErr::Overflow => Inf1CtlCustomProgErr(Inf1CtlErr::MathError).into(),
SwapQuoteErr::Pricing(e) => e.into(),
SwapQuoteErr::ZeroValue => Inf1CtlCustomProgErr(Inf1CtlErr::ZeroValue).into(),
}
Expand All @@ -42,10 +43,13 @@ impl<I: Display + Into<ProgramError>, P: Display + Into<ProgramError>>
let msg = e.to_string();
sol_log(&msg);
match e {
AddLiqQuoteErr::Overflow => Inf1CtlCustomProgErr(Inf1CtlErr::MathError).into(),
AddLiqQuoteErr::ZeroValue => Inf1CtlCustomProgErr(Inf1CtlErr::ZeroValue).into(),
AddLiqQuoteErr::InpCalc(e) => e.into(),
AddLiqQuoteErr::InpDisabled => {
Inf1CtlCustomProgErr(Inf1CtlErr::LstInputDisabled).into()
}
AddLiqQuoteErr::Overflow => Inf1CtlCustomProgErr(Inf1CtlErr::MathError).into(),
AddLiqQuoteErr::Pricing(e) => e.into(),
AddLiqQuoteErr::ZeroValue => Inf1CtlCustomProgErr(Inf1CtlErr::ZeroValue).into(),
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions sol-val-calc/ag/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ use inf1_svc_wsol_std::WsolSvcStd;

// Re-exports
pub use inf1_svc_ag_core::*;
pub use inf1_svc_lido_std;
pub use inf1_svc_marinade_std;
pub use inf1_svc_spl_std;
pub use inf1_svc_wsol_std;

pub mod update;

Expand Down
2 changes: 1 addition & 1 deletion sol-val-calc/lido/core/src/calc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use inf1_svc_core::traits::SolValCalc;
use sanctum_token_ratio_compat::floor_ratio_u64_u64_reverse;
use solido_legacy_core::{ExchangeRate, Lido};

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
pub struct LidoCalc {
pub exchange_rate: ExchangeRate,
pub current_epoch: u64,
Expand Down
2 changes: 1 addition & 1 deletion sol-val-calc/lido/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod update;
pub struct LidoSvcStd {
/// Might be `None` at initialization before accounts required
/// to create the calc have been fetched
calc: Option<LidoCalc>,
pub calc: Option<LidoCalc>,
}

impl Default for LidoSvcStd {
Expand Down
2 changes: 1 addition & 1 deletion sol-val-calc/marinade/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod update;
pub struct MarinadeSvcStd {
/// Might be `None` at initialization before accounts required
/// to create the calc have been fetched
calc: Option<MarinadeCalc>,
pub calc: Option<MarinadeCalc>,
}

impl Default for MarinadeSvcStd {
Expand Down
4 changes: 2 additions & 2 deletions sol-val-calc/spl/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ pub type SplSvcStd = GenSplSvcStd<SplCalcAccs>;
pub struct GenSplSvcStd<A> {
/// Might be `None` at initialization before accounts required
/// to create the calc have been fetched
calc: Option<SplCalc>,
accs: A,
pub calc: Option<SplCalc>,
pub accs: A,
}

/// Constructors
Expand Down
4 changes: 4 additions & 0 deletions std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ version.workspace = true
inf1-core = { workspace = true }
inf1-pp-ag-std = { workspace = true }
inf1-svc-ag-std = { workspace = true }

[dev-dependencies]
inf1-test-utils = { workspace = true }
solana-pubkey = { workspace = true }
Loading