clockwork_network/state/
authority.rs

1use {
2    anchor_lang::{prelude::*, AnchorDeserialize},
3    std::convert::TryFrom,
4};
5
6pub const SEED_AUTHORITY: &[u8] = b"authority";
7
8/**
9 * Authority
10 */
11
12#[account]
13#[derive(Debug)]
14pub struct Authority {}
15
16impl Authority {
17    pub fn pubkey() -> Pubkey {
18        Pubkey::find_program_address(&[SEED_AUTHORITY], &crate::ID).0
19    }
20}
21
22impl TryFrom<Vec<u8>> for Authority {
23    type Error = Error;
24    fn try_from(data: Vec<u8>) -> std::result::Result<Self, Self::Error> {
25        Authority::try_deserialize(&mut data.as_slice())
26    }
27}