Contract 977da7a1608550f7f71fc5b8739570070d16cd307dac68d54b313125cc834656

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.7#211569aa49c8d896877dfca1f2eb4fe9071121c8
rsver 1.81.0

Instances

  • CAWMO5GWEBEHRYPEPEORTK7RZYXGRSFKGFT3LLEU6HKAHSZHPWQGYW7S

Interface

One-time initialization to set admin, treasury, and auth account.

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

Subscribe user to the plan plan_id by paying the plan price in XLM to the treasury. If user already has an active subscription to the same plan, extend the expiration date.

fn subscribe(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    plan_id: u32,
    price: i128,
)

Check if a given user currently has an active (unexpired) subscription.

fn is_sub_active(env: soroban_sdk::Env, user: soroban_sdk::Address) -> bool

Retrieve the subscription details of a user, if any.

fn get_subscription(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
) -> Option

Create a new subscription plan (admin only).

fn create_plan(env: soroban_sdk::Env, plan_id: u32, price: i128, duration: u64)

Update an existing subscription plan's price and/or duration (admin only).

fn update_plan(env: soroban_sdk::Env, plan_id: u32, new_price: i128, new_duration: u64)

Get details of a subscription plan by ID (anyone can call).

fn get_plan(env: soroban_sdk::Env, plan_id: u32) -> Option

Delete a subscription plan (admin only).

fn delete_plan(env: soroban_sdk::Env, plan_id: u32)

Update the treasury account address (admin only).

fn update_treasury(env: soroban_sdk::Env, new_treasury: soroban_sdk::Address)

Imports

WebAssembly Text (WAT) ▶