Initialize the contract with USDC token address
fn init(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
usdc_address: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Create a new red packet (with optional whitelist)
fn create_red_packet(
env: soroban_sdk::Env,
creator: soroban_sdk::Address,
total_amount: i128,
total_users: u32,
whitelist: Option>,
expiration_days: u32,
) -> Result
Claim from a red packet
fn claim_red_packet(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
packet_id: u64,
) -> Result
Refund remaining amount to creator after expiration Anyone can trigger this
fn refund_red_packet(
env: soroban_sdk::Env,
packet_id: u64,
) -> Result
Get red packet info
fn get_red_packet(env: soroban_sdk::Env, packet_id: u64) -> Option
Check if user is in whitelist for a packet
fn is_whitelisted(
env: soroban_sdk::Env,
packet_id: u64,
user: soroban_sdk::Address,
) -> bool
Check if user has claimed a specific packet
fn has_claimed(
env: soroban_sdk::Env,
packet_id: u64,
user: soroban_sdk::Address,
) -> bool
Get user's claim record for a packet
fn get_claim_record(
env: soroban_sdk::Env,
packet_id: u64,
user: soroban_sdk::Address,
) -> Option
Get all claimers for a packet (with pagination)
fn get_claimers(
env: soroban_sdk::Env,
packet_id: u64,
start: u32,
limit: u32,
) -> soroban_sdk::Vec
Get total number of red packets created
fn get_total_packets(env: soroban_sdk::Env) -> u64
Check if red packet is expired
fn is_expired(env: soroban_sdk::Env, packet_id: u64) -> bool
Get admin address
fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address
Get USDC token address
fn get_usdc(env: soroban_sdk::Env) -> soroban_sdk::Address