mango-v4/programs/mango-v4/src/state/group.rs

29 lines
755 B
Rust
Raw Normal View History

use anchor_lang::prelude::*;
use static_assertions::const_assert_eq;
use std::mem::size_of;
// TODO: Assuming we allow up to 65536 different tokens
pub type TokenIndex = u16;
2022-03-07 07:16:34 -08:00
// TODO: Should we call this `Group` instead of `Group`? And `Account` instead of `MangoAccount`?
#[account(zero_copy)]
2022-03-07 07:16:34 -08:00
pub struct Group {
// Relying on Anchor's discriminator be sufficient for our versioning needs?
// pub meta_data: MetaData,
2022-02-23 01:19:54 -08:00
pub admin: Pubkey,
2022-02-25 06:14:15 -08:00
pub bump: u8,
pub reserved: [u8; 7],
}
const_assert_eq!(size_of::<Group>(), 40);
const_assert_eq!(size_of::<Group>() % 8, 0);
2022-02-25 06:14:15 -08:00
#[macro_export]
macro_rules! group_seeds {
( $group:expr ) => {
2022-03-14 05:39:54 -07:00
&[b"Group".as_ref(), $group.admin.as_ref(), &[$group.bump]]
2022-02-25 06:14:15 -08:00
};
}
pub use group_seeds;