use anchor_lang::prelude::*;
use std::borrow::Borrow;
pub const MAX_ROLE_NAME_LEN: usize = 32;
#[derive(Clone, AnchorSerialize, AnchorDeserialize, InitSpace, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "debug", derive(Debug))]
pub struct RoleKey {
#[max_len(MAX_ROLE_NAME_LEN)]
name: String,
}
impl RoleKey {
pub const ORACLE_CONTROLLER: &'static str = "ORACLE_CONTROLLER";
pub const GT_CONTROLLER: &'static str = "GT_CONTROLLER";
pub const MARKET_KEEPER: &'static str = "MARKET_KEEPER";
pub const ORDER_KEEPER: &'static str = "ORDER_KEEPER";
pub const FEATURE_KEEPER: &'static str = "FEATURE_KEEPER";
pub const CONFIG_KEEPER: &'static str = "CONFIG_KEEPER";
pub const RESTART_ADMIN: &'static str = "RESTART_ADMIN";
pub const PRICE_KEEPER: &'static str = "PRICE_KEEPER";
pub const MIGRATION_KEEPER: &'static str = "MIGRATION_KEEPER";
}
impl Borrow<str> for RoleKey {
fn borrow(&self) -> &str {
&self.name
}
}
impl<'a> From<&'a str> for RoleKey {
fn from(value: &'a str) -> Self {
Self {
name: value.to_owned(),
}
}
}