Contract 1dbda19a2c9962cf798b62557f7c6388a3ea3c7c506ddb7aafbd549843510c6b

← Back to Index 📥 Download WASM

Meta

rssdkver 26.0.0#e1bf74ba6c3ddb591593f5eb5dfb85458ff714c1
rsver 1.95.0

Instances

  • CBJMQ6ZYQJ2OMM46FGXPEIKKZDRHHERBXUVE54ZN64FDPKN5DJKSEVQN

Interface

fn get(env: soroban_sdk::Env, id: soroban_sdk::BytesN<32>) -> Subscription
fn pause(env: soroban_sdk::Env, id: soroban_sdk::BytesN<32>)
fn cancel(env: soroban_sdk::Env, id: soroban_sdk::BytesN<32>)

Trigger the next charge.

v0.1 auth model (audit-002 F4): the buyer must sign every charge. buyer.require_auth() is called below. An off-chain scheduler can submit the transaction, but the buyer must produce a fresh signature each time — via smart-wallet session, WalletConnect, or equivalent. v0.2 will replace this with a pre-auth allowance primitive.

fn charge(env: soroban_sdk::Env, id: soroban_sdk::BytesN<32>) -> u64

Buyer authorizes a new subscription. Returns a deterministic 32-byte id. Both buyer and contract authentication are required at the host level (require_auth invocations).

fn create(
    env: soroban_sdk::Env,
    buyer: soroban_sdk::Address,
    merchant: soroban_sdk::Address,
    token: soroban_sdk::Address,
    amount: i128,
    period_seconds: u64,
    max_periods: u32,
    expires_at: u64,
    nonce: soroban_sdk::BytesN<32>,
) -> soroban_sdk::BytesN<32>
fn resume(env: soroban_sdk::Env, id: soroban_sdk::BytesN<32>)

Mark a subscription as Expired if its terminal conditions hold (expires_at passed OR max_periods reached). Anyone can call; idempotent. Returns true if state was changed, false otherwise. This exists because charge() cannot persist a status change while also panicking — Soroban panics revert state.

fn mark_expired(env: soroban_sdk::Env, id: soroban_sdk::BytesN<32>) -> bool

Imports

WebAssembly Text (WAT) ▶