Contract d9831ab45ff4f61f092c7a37acc3394c084cb9b2a3bc3b3349f5ffdfbffbbf55

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.96.1

Instances

  • CA64D4VUN4CPB556M5DBREW24ADQXJOT35YQI54YOVGMJUGADHGMT43M

Interface

Unsubscribe. Unredeemed rewards can still be claimed before cancellation.

fn cancel(env: soroban_sdk::Env, subscriber: soroban_sdk::Address)
fn claimable(env: soroban_sdk::Env, subscriber: soroban_sdk::Address) -> i128

Pay the monthly fee and start the subscription.

Auth note: the subscriber must sign the outer transaction that calls this function. That signature covers the inner token.transfer, so no separate token.approve step is required.

fn subscribe(env: soroban_sdk::Env, subscriber: soroban_sdk::Address)

Deploy once. epoch_ledgers is the key testability knob:

  • Pass 12 for ~60-second "months" on testnet.
  • Pass 518_400 for real 30-day months on mainnet.
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    zi_token: soroban_sdk::Address,
    epoch_ledgers: u32,
    monthly_fee_zi: i128,
)
fn monthly_fee(env: soroban_sdk::Env) -> i128

Claim all pending rewards (50 % of monthly_fee × epochs elapsed since last claim). Rewards are sent to payout_address if set, otherwise back to subscriber. Returns the Zi amount transferred.

fn claim_reward(env: soroban_sdk::Env, subscriber: soroban_sdk::Address) -> i128

Load Zi tokens into the contract so it can pay rewards.

fn fund_reserve(env: soroban_sdk::Env, from: soroban_sdk::Address, amount: i128)
fn epoch_ledgers(env: soroban_sdk::Env) -> u32
fn set_monthly_fee(env: soroban_sdk::Env, monthly_fee_zi: i128)
fn get_subscription(
    env: soroban_sdk::Env,
    subscriber: soroban_sdk::Address,
) -> Option

Switch between test mode (e.g. 12) and production mode (518_400).

fn set_epoch_ledgers(env: soroban_sdk::Env, epoch_ledgers: u32)

Update (or clear) the payout address for reward claims. Pass None to revert to the subscriber's own address.

fn set_payout_address(
    env: soroban_sdk::Env,
    subscriber: soroban_sdk::Address,
    payout: Option,
)

Imports

WebAssembly Text (WAT) ▶