One-time setup. Records the admin and the streamed token (XLM SAC) and unpauses the contract.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
token: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Lock total_amount of the configured token into a new stream and return
its id. Vesting runs linearly from start_time to end_time.
Auth: requires the payer's signature. The same authorization covers the
inner SAC transfer(payer -> contract).
fn create_stream(
env: soroban_sdk::Env,
payer: soroban_sdk::Address,
recipient: soroban_sdk::Address,
total_amount: i128,
start_time: u64,
end_time: u64,
) -> Result
Withdraw everything that has vested but not yet been paid out. Funds are
always sent to the stream's fixed recipient, so this is intentionally
permissionless (anyone may poke it; nobody but the recipient can be paid).
Returns the amount transferred.
fn withdraw(env: soroban_sdk::Env, stream_id: u64) -> Result
Stop a stream early. The payer settles whatever has vested so far to the recipient and reclaims the unvested remainder. Returns the reclaimed amount.
Auth: requires the payer's signature.
fn stop(env: soroban_sdk::Env, stream_id: u64) -> Result
fn get_stream(
env: soroban_sdk::Env,
stream_id: u64,
) -> Result
Total amount vested so far for a stream (independent of withdrawals).
fn vested_amount(
env: soroban_sdk::Env,
stream_id: u64,
) -> Result
Amount the recipient could withdraw right now (vested - withdrawn).
fn withdrawable(
env: soroban_sdk::Env,
stream_id: u64,
) -> Result
fn total_streams(env: soroban_sdk::Env) -> u64
fn is_paused(env: soroban_sdk::Env) -> bool
fn get_admin(env: soroban_sdk::Env) -> Result
fn get_token(env: soroban_sdk::Env) -> Result
fn pause(env: soroban_sdk::Env) -> Result<(), soroban_sdk::Error>
fn unpause(env: soroban_sdk::Env) -> Result<(), soroban_sdk::Error>
fn set_admin(
env: soroban_sdk::Env,
new_admin: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Replace the contract's own code (admin-gated). Enables shipping fixes without migrating stream state — important for a mainnet (L6) deploy.
fn upgrade(
env: soroban_sdk::Env,
new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>