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:
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,
)