mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-19 15:10:29 +00:00
bus checks
This commit is contained in:
16
src/utils.rs
16
src/utils.rs
@@ -36,15 +36,20 @@ pub(crate) fn create_pda<'a, 'info>(
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
|
||||
pub enum AccountDiscriminator {
|
||||
Bus = 100,
|
||||
Proof = 101,
|
||||
Treasury = 102,
|
||||
Bus = 0,
|
||||
Proof = 1,
|
||||
Treasury = 2,
|
||||
}
|
||||
|
||||
pub trait Discriminator {
|
||||
fn discriminator() -> AccountDiscriminator;
|
||||
}
|
||||
|
||||
pub trait AccountDeserialize {
|
||||
fn try_from_bytes(data: &[u8]) -> Result<&Self, ProgramError>;
|
||||
fn try_from_bytes_mut(data: &mut [u8]) -> Result<&mut Self, ProgramError>;
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! impl_to_bytes {
|
||||
($struct_name:ident) => {
|
||||
@@ -56,11 +61,6 @@ macro_rules! impl_to_bytes {
|
||||
};
|
||||
}
|
||||
|
||||
pub trait AccountDeserialize {
|
||||
fn try_from_bytes(data: &[u8]) -> Result<&Self, ProgramError>;
|
||||
fn try_from_bytes_mut(data: &mut [u8]) -> Result<&mut Self, ProgramError>;
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! impl_account_from_bytes {
|
||||
($struct_name:ident) => {
|
||||
|
||||
Reference in New Issue
Block a user