//! Altius Constants
//!
//! This crate provides Altius-specific constants that can be shared across
//! different components of the Altius ecosystem, including addresses and prefixes.
//!
//! This crate is designed to be published to crates.io for use by external projects
//! like revm forks.

use alloy_primitives::{address, Address};

// ============================================================================
// Fee Token Address Prefix (10 bytes)
// ============================================================================

/// Fee token address prefix for Altius v1.0 (10 bytes)
///
/// All valid Altius fee tokens start with this prefix: `0xA17000...00` (10 bytes)
pub const FEE_TOKEN_PREFIX_BYTES: [u8; 10] = [
    0xA1, 0x70, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00,
];

/// Legacy 2-byte prefix for backward compatibility
pub const FEE_TOKEN_PREFIX: [u8; 2] = [0xA1, 0x70];

// ============================================================================
// Fee System Addresses
// ============================================================================

/// Fee Manager (Independent prefix)
///
/// The fee manager collects fee tokens and can distribute them.
/// Address: 0xFE00000000000000000000000000000000000001
pub const FEE_MANAGER_ADDRESS: Address =
    address!("FE00000000000000000000000000000000000001");

/// Fee Token Factory
///
/// Factory contract for creating new fee tokens.
/// Address: 0xa1700000000000000000000000000000000000000 (index 0)
pub const FEE_TOKEN_FACTORY_ADDRESS: Address =
    address!("a170000000000000000000000000000000000000");

/// USDA Fee Token (ERC20) - Genesis Fee Token
///
/// This is the primary fee token for USD-denominated transactions.
/// Address: 0xa1700000000000000000000000000000000000001 (index 1)
pub const USDA_ADDRESS: Address =
    address!("a170000000000000000000000000000000000001");

/// Legacy alias for USDA address
pub const FEE_TOKEN_ADDRESS: Address = USDA_ADDRESS;

// ============================================================================
// Helper Functions
// ============================================================================

/// Check if an address has the Altius fee token prefix (10 bytes).
///
/// Valid fee tokens must start with `0xA17000...00` (10 bytes).
pub fn is_fee_token_prefix(addr: Address) -> bool {
    addr.as_slice().starts_with(&FEE_TOKEN_PREFIX_BYTES)
}
