altius-tx-sdk 0.1.0

SDK for signing and sending Altius USD multi-token transactions
Documentation
//! Constants for Altius USD multi-token transactions.
//!
//! These constants define the default fee parameters for USD multi-token chains.
//!
//! **IMPORTANT**: This is the single source of truth for Rust code.
//! All addresses must be defined here AND in the JS SDK (sdk/js/src/constants.js).
//! When modifying addresses, update BOTH SDKs.

// ============================================================================
// Address Constants
//!
//! These addresses are derived from the Altius predeploy system.
//! See `altius-predeploy/src/addresses.rs` for the authoritative source.
// ============================================================================

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

/// Fee Token Factory (index 0)
///
/// Factory contract for creating new fee tokens.
/// Address: 0xA170000000000000000000000000000000000000
pub const FEE_TOKEN_FACTORY_ADDRESS: &str = "0xA170000000000000000000000000000000000000";

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

/// Alternative fee token for testing (index 2)
///
/// Address: 0xa170000000000000000000000000000000000002
pub const ALT_FEE_TOKEN_ADDRESS: &str = "0xa170000000000000000000000000000000000002";

/// Fee token prefix (10 bytes) for validation
pub const FEE_TOKEN_PREFIX: &str = "0xa1700000";

// ============================================================================
// Fee Configuration
// ============================================================================

/// Base fee in attodollars per gas (50 G-attodollars/gas).
///
/// # Unit Explanation
///
/// - attodollar = 10^-18 USD
/// - G-attodollar = 10^9 attodollars
/// - 50 G-attodollars/gas = 50 * 10^9 attodollars/gas
///
/// # Example Calculation
///
/// For a standard ERC20 transfer using 21,000 gas:
/// ```text
/// fee = 21,000 gas * 50 * 10^9 attodollars/gas
///     = 1,050,000,000,000,000 attodollars
///     ≈ 0.001 USDA (with 18 decimals)
/// ```
pub const BASE_FEE_ATTO: u64 = 50_000_000_000;

// ============================================================================
// Token Configuration
// ============================================================================

/// Default faucet amount in token units (100 USDA with 18 decimals).
///
/// 100 * 10^18 = 100,000,000,000,000,000,000
pub const DEFAULT_FAUCET_AMOUNT: u128 = 100_000_000_000_000_000_000;

/// Default faucet amount in microdollars (for backward compatibility).
///
/// 100 USDA = 100_000_000 microdollars (6 decimals)
pub const DEFAULT_FAUCET_AMOUNT_MICRO: u64 = 100_000_000;

// ============================================================================
// Gas Configuration
// ============================================================================

/// Default gas limit for ERC20 transfers.
pub const DEFAULT_GAS_LIMIT: u64 = 100_000;