make voter_pubkey a function of epoch (#5830)
* make voter_pubkey a function of epoch * fixups
This commit is contained in:
@@ -1,13 +1,39 @@
|
||||
use crate::budget_expr::BudgetExpr;
|
||||
use crate::budget_state::BudgetState;
|
||||
use crate::id;
|
||||
use crate::{budget_expr::BudgetExpr, budget_state::BudgetState, id};
|
||||
use bincode::serialized_size;
|
||||
use chrono::prelude::{DateTime, Utc};
|
||||
use num_derive::FromPrimitive;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::instruction::{AccountMeta, Instruction};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::system_instruction;
|
||||
use solana_sdk::{
|
||||
hash::Hash,
|
||||
instruction::{AccountMeta, Instruction},
|
||||
instruction_processor_utils::DecodeError,
|
||||
pubkey::Pubkey,
|
||||
system_instruction,
|
||||
};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, FromPrimitive)]
|
||||
pub enum BudgetError {
|
||||
DestinationMissing,
|
||||
}
|
||||
|
||||
impl<T> DecodeError<T> for BudgetError {
|
||||
fn type_of() -> &'static str {
|
||||
"BudgetError"
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for BudgetError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{}",
|
||||
match self {
|
||||
BudgetError::DestinationMissing => "destination missing",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
impl std::error::Error for BudgetError {}
|
||||
|
||||
/// A smart contract.
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
|
||||
|
@@ -1,14 +1,15 @@
|
||||
//! budget program
|
||||
use crate::budget_expr::Witness;
|
||||
use crate::budget_instruction::BudgetInstruction;
|
||||
use crate::budget_state::{BudgetError, BudgetState};
|
||||
use crate::{
|
||||
budget_expr::Witness,
|
||||
budget_instruction::{BudgetError, BudgetInstruction},
|
||||
budget_state::BudgetState,
|
||||
};
|
||||
use bincode::deserialize;
|
||||
use chrono::prelude::{DateTime, Utc};
|
||||
use log::*;
|
||||
use solana_sdk::account::KeyedAccount;
|
||||
use solana_sdk::hash::hash;
|
||||
use solana_sdk::instruction::InstructionError;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::{
|
||||
account::KeyedAccount, hash::hash, instruction::InstructionError, pubkey::Pubkey,
|
||||
};
|
||||
|
||||
/// Process a Witness Signature. Any payment plans waiting on this signature
|
||||
/// will progress one step.
|
||||
|
@@ -1,28 +1,8 @@
|
||||
//! 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, FromPrimitive)]
|
||||
pub enum BudgetError {
|
||||
DestinationMissing,
|
||||
}
|
||||
|
||||
impl<T> DecodeError<T> for BudgetError {
|
||||
fn type_of() -> &'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 {
|
||||
|
Reference in New Issue
Block a user