Contract d170938c145fcb6a1b1b13195237f93a795db66ad41534acf5dda868b4950251

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.94.1

Instances

  • CBX65LDJI5TQU6CAOD4EWAIM22VWF54Y4OXUJVKUSFLKQSBXAJLW3HHQ

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.

fn initialize(env: soroban_sdk::Env, admin: soroban_sdk::Address)

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) ▶