@@ -12,6 +12,8 @@ edition = "2018"
|
||||
bincode = "1.1.3"
|
||||
chrono = { version = "0.4.0", features = ["serde"] }
|
||||
log = "0.4.2"
|
||||
num-derive = "0.2"
|
||||
num-traits = "0.2"
|
||||
serde = "1.0.90"
|
||||
serde_derive = "1.0.90"
|
||||
solana-sdk = { path = "../../sdk", version = "0.14.0" }
|
||||
|
@@ -1,14 +1,29 @@
|
||||
//! budget state
|
||||
use crate::budget_expr::BudgetExpr;
|
||||
use bincode::{self, deserialize, serialize_into};
|
||||
use num_derive::FromPrimitive;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use solana_sdk::instruction::InstructionError;
|
||||
use solana_sdk::instruction_processor_utils::DecodeError;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, FromPrimitive)]
|
||||
pub enum BudgetError {
|
||||
DestinationMissing,
|
||||
}
|
||||
|
||||
impl<T> DecodeError<T> for BudgetError {
|
||||
fn type_of(&self) -> &'static str {
|
||||
"BudgetError"
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for BudgetError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "error")
|
||||
}
|
||||
}
|
||||
impl std::error::Error for BudgetError {}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq)]
|
||||
pub struct BudgetState {
|
||||
pub initialized: bool,
|
||||
|
Reference in New Issue
Block a user