trident_svm/
utils.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use solana_program_runtime::invoke_context::BuiltinFunctionWithContext;

use solana_sdk::account::AccountSharedData;
use solana_sdk::pubkey::Pubkey;

pub struct ProgramEntrypoint {
    pub(crate) program_id: Pubkey,
    pub(crate) authority: Option<Pubkey>,
    pub(crate) entry: Option<BuiltinFunctionWithContext>,
}
impl ProgramEntrypoint {
    pub fn new(
        program_id: Pubkey,
        authority: Option<Pubkey>,
        entry_fn: Option<BuiltinFunctionWithContext>,
    ) -> ProgramEntrypoint {
        Self {
            program_id,
            authority,
            entry: entry_fn,
        }
    }
}

pub struct SBFTargets {
    pub(crate) program_id: Pubkey,
    pub(crate) authority: Option<Pubkey>,
    pub(crate) data: Vec<u8>,
}
impl SBFTargets {
    pub fn new(program_id: Pubkey, authority: Option<Pubkey>, data: Vec<u8>) -> SBFTargets {
        Self {
            program_id,
            authority,
            data,
        }
    }
}

pub struct TridentAccountSharedData {
    pub address: Pubkey,
    pub account: AccountSharedData,
}
impl TridentAccountSharedData {
    pub fn new(address: Pubkey, account: AccountSharedData) -> TridentAccountSharedData {
        Self { address, account }
    }
}