arch_program 0.6.4

A Rust library for building programs that run inside the Arch Virtual Machine. Provides core functionality for creating instructions, managing accounts, handling program errors, and interacting with the Arch runtime environment. Includes utilities for logging, transaction handling, and Bitcoin UTXO management.
Documentation
use crate::pubkey::Pubkey;
crate::declare_id!("BpfLoader1111111111111111111111111111111111");

/// This is native loader
/// used for invoking native programs, this doesn't have a an account on it's own,
/// but native programs use this address in their owner's field.
/// Backwards-compatible alias for the BPF loader program ID.
pub const BPF_LOADER_ID: Pubkey = ID;

#[repr(u64)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum LoaderStatus {
    /// Program is in maintenance
    Retracted,
    /// Program is ready to be executed
    Deployed,
    /// Same as `Deployed`, but can not be retracted anymore
    Finalized,
}

/// LoaderV4 account states
#[repr(C)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub struct LoaderState {
    /// Address of signer which can send program management instructions.
    /// Otherwise a forwarding to the next version of the finalized program.
    pub authority_address_or_next_version: Pubkey,
    /// Deployment status.
    pub status: LoaderStatus,
}

impl LoaderState {
    /// Size of a serialized program account.
    pub const fn program_data_offset() -> usize {
        std::mem::size_of::<Self>()
    }
}