#![cfg(feature = "agave-unstable-api")]
use {
solana_account::AccountSharedData, solana_clock::Slot,
solana_precompile_error::PrecompileError, solana_pubkey::Pubkey,
};
pub trait InvokeContextCallback {
fn get_epoch_stake(&self) -> u64 {
0
}
fn get_epoch_stake_for_vote_account(&self, _vote_address: &Pubkey) -> u64 {
0
}
fn is_precompile(&self, _program_id: &Pubkey) -> bool {
false
}
fn process_precompile(
&self,
_program_id: &Pubkey,
_data: &[u8],
_instruction_datas: Vec<&[u8]>,
) -> Result<(), PrecompileError> {
Err(PrecompileError::InvalidPublicKey)
}
}
pub trait TransactionProcessingCallback: InvokeContextCallback {
fn get_account_shared_data(&self, pubkey: &Pubkey) -> Option<(AccountSharedData, Slot)>;
fn inspect_account(&self, _address: &Pubkey, _account_state: AccountState, _is_writable: bool) {
}
}
#[derive(Debug)]
pub enum AccountState<'a> {
Dead,
Alive(&'a AccountSharedData),
}