gmsol_store/instructions/exchange/
mod.rs1pub mod deposit;
3
4pub mod withdrawal;
6
7pub mod order;
9
10pub mod execute_deposit;
12
13pub mod execute_withdrawal;
15
16pub mod execute_order;
18
19pub mod update_adl;
21
22pub mod position_cut;
24
25pub mod shift;
27
28pub mod execute_shift;
30
31pub use deposit::*;
32pub use execute_deposit::*;
33pub use execute_order::*;
34pub use execute_shift::*;
35pub use execute_withdrawal::*;
36pub use order::*;
37pub use position_cut::*;
38pub use shift::*;
39pub use update_adl::*;
40pub use withdrawal::*;
41
42use crate::CoreError;
43
44pub(crate) struct ModelError(gmsol_model::Error);
45
46impl From<gmsol_model::Error> for ModelError {
47 fn from(err: gmsol_model::Error) -> Self {
48 Self(err)
49 }
50}
51
52impl From<ModelError> for anchor_lang::prelude::Error {
53 fn from(err: ModelError) -> Self {
54 match err.0 {
55 gmsol_model::Error::EmptyDeposit => CoreError::EmptyDeposit.into(),
56 gmsol_model::Error::Solana(err) => err,
57 core_error => {
58 crate::msg!("A model error occurred. Error Message: {}", core_error);
59 CoreError::Model.into()
60 }
61 }
62 }
63}