Contract f88a9f7bd280426943c82348a60f2a19cfcf302e49bbf0d627fe05b13ffb4185

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.94.1

Instances

  • CCFK2TZH42AIOP6Q2RAHFDR2XIXBMNS2EMABOTSAVXED6N2BC6WVD2GI

Interface

Redeem (burn) a coupon token by its code. This is the core operation — irreversible destruction of the token. Returns a RedemptionReceipt as cryptographic proof.

fn redeem(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    code: soroban_sdk::String,
    redeemer_name: soroban_sdk::String,
    reference: soroban_sdk::String,
) -> Result

Verify a coupon by its code. Anyone can call this. No auth required — this is the public verification interface.

fn verify(
    env: soroban_sdk::Env,
    code: soroban_sdk::String,
) -> Result

Check if a coupon code is valid and available for redemption.

fn is_valid(env: soroban_sdk::Env, code: soroban_sdk::String) -> bool

Initialize the contract with an admin address. The admin can create campaigns and mint coupons. VULN-06: Returns Result instead of panicking on re-init.

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Mint a batch of coupon tokens for a campaign. Each code becomes a unique on-chain NFT-like token. Returns the list of token IDs.

fn mint_batch(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    campaign_id: u64,
    codes: soroban_sdk::Vec,
) -> Result, soroban_sdk::Error>

Get campaign details.

fn get_campaign(
    env: soroban_sdk::Env,
    campaign_id: u64,
) -> Result

Total coupons burned (redeemed) across all campaigns.

fn total_burned(env: soroban_sdk::Env) -> u64

Total coupons minted across all campaigns.

fn total_minted(env: soroban_sdk::Env) -> u64

Get campaign statistics.

fn campaign_stats(
    env: soroban_sdk::Env,
    campaign_id: u64,
) -> Result

Create a new coupon campaign. Only the admin can call this. Returns the campaign ID.

fn create_campaign(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    name: soroban_sdk::String,
    discount_type: soroban_sdk::String,
    discount_value: u64,
    total_supply: u32,
    valid_until: u64,
) -> Result

Total campaigns created.

fn total_campaigns(env: soroban_sdk::Env) -> u64

Imports

WebAssembly Text (WAT) ▶