Contract 9af3cb44f542580e0828c39a1d3dfc4936d8bf77303f27e8965e232168b519fd

← Back to Index 📥 Download WASM

Meta

cliver 25.2.0#28484880988199233a7e8e87c97cb12dac323cb3
license BSL-1.1
name ZebecStream
repo https://github.com/zebec-protocol/zebec-stream-stellar
rssdkver 23.5.3#d3e1ab2424388b10893b796b0c8e405c5edd03d2
rsver 1.90.0-nightly
version 1.4.8

Instances

  • CANFQL6PTXASAPKIWR6OMANYE7XE6NANQNV5NM5OFEA5SAF5ZL3VM5HG

Interface

fn upgrade(
    env: soroban_sdk::Env,
    new_wasm_hash: soroban_sdk::BytesN<32>,
    operator: soroban_sdk::Address,
)

Initialise the protocol. Sets the owner and the initial StreamConfig.

fn __constructor(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    config: StreamConfig,
) -> Result<(), StreamError>
fn get_config(env: soroban_sdk::Env) -> StreamConfig
fn is_sender_whitelisted(env: soroban_sdk::Env, sender: soroban_sdk::Address) -> bool
fn whitelist_tokens(
    env: soroban_sdk::Env,
    tokens: soroban_sdk::Vec,
) -> Result<(), StreamError>
fn remove_whitelisted_token(
    env: soroban_sdk::Env,
    token: soroban_sdk::Address,
) -> Result<(), StreamError>
fn whitelist_senders(
    env: soroban_sdk::Env,
    senders: soroban_sdk::Vec,
)
fn remove_whitelisted_sender(env: soroban_sdk::Env, sender: soroban_sdk::Address)
fn set_fee_config(
    env: soroban_sdk::Env,
    fee_recipient: soroban_sdk::Address,
    withdraw_account: soroban_sdk::Address,
    platform_fee: i64,
    base_fee: i64,
    fee_tiers: soroban_sdk::Vec,
) -> Result<(), StreamError>
fn set_frequencies(
    env: soroban_sdk::Env,
    frequencies: soroban_sdk::Vec,
) -> Result<(), StreamError>

Atomically update all mutable config fields in one call.

fn update_config(
    env: soroban_sdk::Env,
    fee_recipient: soroban_sdk::Address,
    withdraw_account: soroban_sdk::Address,
    platform_fee: i64,
    base_fee: i64,
    fee_tiers: soroban_sdk::Vec,
    frequencies: soroban_sdk::Vec,
) -> Result<(), StreamError>

Read back the tenant fee config for sender. Returns None if not set (uses global).

fn get_tenant_config(
    env: soroban_sdk::Env,
    sender: soroban_sdk::Address,
) -> Option

Set (or overwrite) a per-tenant fee config for sender. When set, streams created by sender will route fees to fee_recipient using this fee schedule instead of the global config.

fn set_tenant_config(
    env: soroban_sdk::Env,
    sender: soroban_sdk::Address,
    fee_recipient: soroban_sdk::Address,
    withdraw_account: soroban_sdk::Address,
    platform_fee: i64,
    base_fee: i64,
    fee_tiers: soroban_sdk::Vec,
) -> Result<(), StreamError>

Remove the per-tenant fee config for sender. Streams will fall back to global config.

fn remove_tenant_config(env: soroban_sdk::Env, sender: soroban_sdk::Address)

Create a new payment stream.

stream_id must be unique random bytes — generate with crypto.getRandomValues(new Uint8Array(32)) on the client (same as Solana's freshly generated account keypair). Duplicate IDs are rejected.

fn create_stream(
    env: soroban_sdk::Env,
    stream_id: soroban_sdk::BytesN<32>,
    sender: soroban_sdk::Address,
    receiver: soroban_sdk::Address,
    token: soroban_sdk::Address,
    params: CreateStreamParams,
) -> Result<(), StreamError>
fn get_stream(
    env: soroban_sdk::Env,
    stream_id: soroban_sdk::BytesN<32>,
) -> PaymentStream
fn get_withdrawable_amount(
    env: soroban_sdk::Env,
    stream_id: soroban_sdk::BytesN<32>,
) -> i64
fn pause_resume_stream(
    env: soroban_sdk::Env,
    stream_id: soroban_sdk::BytesN<32>,
) -> Result<(), StreamError>
fn cancel_stream(
    env: soroban_sdk::Env,
    stream_id: soroban_sdk::BytesN<32>,
    caller: soroban_sdk::Address,
) -> Result<(), StreamError>
fn withdraw_stream(
    env: soroban_sdk::Env,
    stream_id: soroban_sdk::BytesN<32>,
    caller: soroban_sdk::Address,
) -> Result<(), StreamError>
fn change_recipient(
    env: soroban_sdk::Env,
    stream_id: soroban_sdk::BytesN<32>,
    caller: soroban_sdk::Address,
    new_receiver: soroban_sdk::Address,
) -> Result<(), StreamError>

Manual top-up: sender must sign.

fn topup_stream(
    env: soroban_sdk::Env,
    stream_id: soroban_sdk::BytesN<32>,
    amount: i64,
) -> Result<(), StreamError>

Automatic top-up: any caller may trigger. Security gate is the SAC allowance.

fn trigger_topup(
    env: soroban_sdk::Env,
    stream_id: soroban_sdk::BytesN<32>,
    amount: i64,
) -> Result<(), StreamError>

Returns Some(Address) if ownership is set, or None if ownership has been renounced.

Arguments

  • e - Access to the Soroban environment.
fn get_owner(env: soroban_sdk::Env) -> Option

Initiates a 2-step ownership transfer to a new address.

Requires authorization from the current owner. The new owner must later call accept_ownership() to complete the transfer.

Arguments

  • e - Access to the Soroban environment.
  • new_owner - The proposed new owner.
  • live_until_ledger - Ledger number until which the new owner can accept. A value of 0 cancels any pending transfer.

Errors

  • [OwnableError::OwnerNotSet] - If the owner is not set.
  • [crate::role_transfer::RoleTransferError::NoPendingTransfer] - If trying to cancel a transfer that doesn't exist.
  • [crate::role_transfer::RoleTransferError::InvalidLiveUntilLedger] - If the specified ledger is in the past.
  • [crate::role_transfer::RoleTransferError::InvalidPendingAccount] - If the specified pending account is not the same as the provided new address.

Notes

  • Authorization for the current owner is required.
fn transfer_ownership(
    env: soroban_sdk::Env,
    new_owner: soroban_sdk::Address,
    live_until_ledger: u32,
)

Accepts a pending ownership transfer.

Arguments

  • e - Access to the Soroban environment.

Errors

  • [crate::role_transfer::RoleTransferError::NoPendingTransfer] - If there is no pending transfer to accept.

Events

  • topics - ["ownership_transfer_completed"]
  • data - [new_owner: Address]
fn accept_ownership(env: soroban_sdk::Env)

Renounces ownership of the contract.

Permanently removes the owner, disabling all functions gated by #[only_owner].

Arguments

  • e - Access to the Soroban environment.

Errors

  • [OwnableError::TransferInProgress] - If there is a pending ownership transfer.
  • [OwnableError::OwnerNotSet] - If the owner is not set.

Notes

  • Authorization for the current owner is required.
fn renounce_ownership(env: soroban_sdk::Env)
fn paused(env: soroban_sdk::Env) -> bool
fn pause(env: soroban_sdk::Env, caller: soroban_sdk::Address)
fn unpause(env: soroban_sdk::Env, caller: soroban_sdk::Address)

Imports

WebAssembly Text (WAT) ▶