typhoon_traits/lib.rs
1//! Traits for the Typhoon protocol.
2//!
3//! This crate contains common traits used in the Typhoon ecosystem.
4
5#![no_std]
6
7mod account;
8
9pub use account::*;
10use solana_address::Address;
11
12/// Trait to check whether a program ID matches an expected program.
13pub trait CheckProgramId {
14 /// Returns `true` if the given program ID matches this program.
15 fn address_eq(program_id: &Address) -> bool;
16}
17
18/// Trait to check whether a program ID is a valid owner.
19pub trait CheckOwner {
20 /// Returns `true` if the given program ID is an allowed owner.
21 fn owned_by(program_id: &Address) -> bool;
22}
23
24/// Trait to define the unique discriminator for an account.
25pub trait Discriminator {
26 /// The discriminator bytes.
27 const DISCRIMINATOR: &'static [u8];
28}