state.rs 475 B

12345678910111213141516171819202122
  1. use steel::*;
  2. use crate::consts::COUNTER_SEED;
  3. #[repr(u8)]
  4. #[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
  5. pub enum CounterAccount {
  6. Counter = 0,
  7. }
  8. #[repr(C)]
  9. #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
  10. pub struct Counter {
  11. pub value: u64,
  12. }
  13. account!(CounterAccount, Counter);
  14. /// Fetch PDA of the counter account.
  15. pub fn counter_pda() -> (Pubkey, u8) {
  16. Pubkey::find_program_address(&[COUNTER_SEED], &crate::id())
  17. }