airdrop-api 0.1.0

Mint and Airdrop Framework on Solana for Sovereign Individuals
Documentation
use solana_program::pubkey::Pubkey;
use steel::*;

/// Event emitted when program config is initialized
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct ConfigInitializedEvent {
    pub admin: Pubkey,
    pub mint_fee_lamports: u64,
    pub allocation_fee_per_recipient_lamports: u64,
    pub fee_account: Pubkey,
    pub initialized_at: i64,
}

/// Event emitted when a mint is created
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct MintCreatedEvent {
    pub mint: Pubkey,
    pub mint_authority: Pubkey,
    pub admin: Pubkey,
    /// Max supply minted (all tokens minted upfront, mint authority revoked)
    pub max_supply: u64,
    pub created_at: i64,
}

/// Event emitted when a campaign is created
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct CampaignCreatedEvent {
    pub campaign: Pubkey,
    pub mint: Pubkey,
    pub owner: Pubkey,
    pub merkle_root: [u8; 32],
    pub initial_supply: u64,
    pub created_at: i64,
}

/// Event emitted when tokens are allocated (on-chain allocation accounts)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct TokensAllocatedEvent {
    pub campaign: Pubkey,
    pub recipient: Pubkey,
    pub amount: u64,
}

/// Event emitted when tokens are claimed
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct TokensClaimedEvent {
    pub campaign: Pubkey,
    pub recipient: Pubkey,
    pub amount: u64,
    pub method: u8,        // 0=allocation, 1=record, 2=merkle
    pub _padding: [u8; 7], // Padding for alignment
}

/// Event emitted when config is updated
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct ConfigUpdatedEvent {
    pub admin: Pubkey,
    pub mint_fee_lamports: u64,
    pub allocation_fee_per_recipient_lamports: u64,
    pub merkle_fee_per_recipient_lamports: u64,
    pub direct_transfer_fee_per_recipient_lamports: u64,
    pub updated_at: i64,
}

/// Event emitted when fees are withdrawn
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct FeesWithdrawnEvent {
    pub admin: Pubkey,
    pub beneficiary: Pubkey,
    pub amount: u64,
    pub remaining_balance: u64,
}

/// Event emitted when tokens are minted to campaign treasury
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct TokensMintedEvent {
    pub campaign: Pubkey,
    pub mint: Pubkey,
    pub amount: u64,
    pub new_supply: u64,
    pub minted_at: i64,
}

/// Event emitted when tokens are replenished to campaign treasury
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct TokensReplenishedEvent {
    pub campaign: Pubkey,
    pub mint: Pubkey,
    pub amount: u64,
    pub new_balance: u64,
    pub replenished_at: i64,
}

/// Event emitted when tokens are directly transferred to recipients
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct TokensDirectTransferredEvent {
    pub campaign: Pubkey,
    pub recipient_count: u8,
    pub _padding1: [u8; 7], // Padding to align next u64
    pub total_amount: u64,
    pub transferred_at: i64,
    pub _padding2: [u8; 8], // Padding for 8-byte alignment (total size must be multiple of 8)
}

event!(ConfigInitializedEvent);
event!(MintCreatedEvent);
event!(CampaignCreatedEvent);
event!(TokensAllocatedEvent);
event!(TokensClaimedEvent);
event!(ConfigUpdatedEvent);
event!(FeesWithdrawnEvent);
event!(TokensMintedEvent);
event!(TokensReplenishedEvent);
event!(TokensDirectTransferredEvent);