2022-02-10 01:04:47 -08:00
|
|
|
use anchor_lang::prelude::*;
|
|
|
|
|
2022-02-22 00:32:21 -08:00
|
|
|
// 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`?
|
2022-02-22 00:32:21 -08:00
|
|
|
#[account(zero_copy)]
|
2022-03-07 07:16:34 -08:00
|
|
|
pub struct Group {
|
2022-02-22 00:32:21 -08:00
|
|
|
// 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-22 00:32:21 -08:00
|
|
|
|
|
|
|
//pub num_oracles: usize, // incremented every time add_oracle is called
|
|
|
|
//pub oracles: [Pubkey; MAX_PAIRS],
|
2022-03-14 05:34:54 -07:00
|
|
|
|
2022-02-22 00:32:21 -08:00
|
|
|
//pub spot_markets: [SpotMarketInfo; MAX_PAIRS],
|
|
|
|
//pub perp_markets: [PerpMarketInfo; MAX_PAIRS],
|
2022-02-10 00:07:34 -08:00
|
|
|
|
2022-02-22 00:32:21 -08:00
|
|
|
//pub signer_nonce: u64,
|
|
|
|
//pub signer_key: Pubkey,
|
2022-02-10 01:49:45 -08:00
|
|
|
// todo: which more dex'es do we want to support? orca for pure swap?
|
2022-02-22 00:32:21 -08:00
|
|
|
//pub dex_program_id: Pubkey,
|
2022-02-10 00:07:34 -08:00
|
|
|
|
2022-02-22 00:32:21 -08:00
|
|
|
//pub cache_valid_interval: u64,
|
2022-02-10 00:07:34 -08:00
|
|
|
|
2022-02-10 01:49:45 -08:00
|
|
|
// todo: do we need this limit? afaik this was for ts liquidator to keep on working, maybe
|
|
|
|
// with liquidatable-accounts-feed we have some sort of scaling? maybe we bought
|
|
|
|
// some more breathing space?
|
2022-02-22 00:32:21 -08:00
|
|
|
//pub max_mango_accounts: u32, // limits maximum number of MangoAccounts.v1 (closeable) accounts
|
|
|
|
//pub num_mango_accounts: u32, // number of MangoAccounts.v1
|
|
|
|
|
|
|
|
//pub ref_surcharge_centibps: u32, // 100
|
|
|
|
//pub ref_share_centibps: u32, // 80 (must be less than surcharge)
|
|
|
|
//pub ref_mngo_required: u64,
|
2022-02-25 06:14:15 -08:00
|
|
|
pub bump: u8,
|
2022-02-10 00:07:34 -08:00
|
|
|
}
|
2022-02-22 00:32:21 -08:00
|
|
|
// TODO: static assert the size and alignment
|
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
|
|
|
};
|
|
|
|
}
|
2022-02-28 02:18:35 -08:00
|
|
|
|
|
|
|
pub use group_seeds;
|