Cancel a stream and reclaim unvested tokens.
Sender-only. The stream must be cancelable and not already depleted or canceled. Returns the refunded amount.
fn cancel(env: soroban_sdk::Env, stream_id: u64, sender: soroban_sdk::Address) -> i128
Create a new Lockup stream.
The sender must have approved the token transfer for params.total_amount.
All tokens are transferred to the contract immediately.
params — All creation parameters bundled into a CreateLockupParams struct.The newly assigned stream ID.
fn create(env: soroban_sdk::Env, params: CreateLockupParams) -> u64
Check if the stream is in a "cold" state.
fn is_cold(env: soroban_sdk::Env, stream_id: u64) -> bool
Check if the stream is in a "warm" state.
fn is_warm(env: soroban_sdk::Env, stream_id: u64) -> bool
Emergency upgrade — bypasses timelock.
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Permanently renounce the ability to cancel a stream.
Sender-only. Once renounced, the stream cannot be canceled.
fn renounce(env: soroban_sdk::Env, stream_id: u64, sender: soroban_sdk::Address)
Withdraw vested tokens from a stream.
Only the stream recipient can withdraw.
fn withdraw(
env: soroban_sdk::Env,
stream_id: u64,
caller: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
Direct admin transfer (legacy, kept for backwards compatibility).
fn set_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
Get the stream's current status.
fn status_of(env: soroban_sdk::Env, stream_id: u64) -> LockupStatus
Get the full stream record.
fn get_stream(env: soroban_sdk::Env, stream_id: u64) -> LockupStream
Initialize the contract with an admin address.
Must be called exactly once before any other function. The intended admin must authorize the initialization.
fn initialize(env: soroban_sdk::Env, admin: soroban_sdk::Address)
Accept an admin transfer (two-step transfer, step 2).
fn accept_admin(env: soroban_sdk::Env)
Withdraw the maximum available amount from a stream.
Convenience function — withdraws the entire withdrawable amount.
fn withdraw_max(
env: soroban_sdk::Env,
stream_id: u64,
caller: soroban_sdk::Address,
to: soroban_sdk::Address,
) -> i128
Check if the stream is cancelable.
fn is_cancelable(env: soroban_sdk::Env, stream_id: u64) -> bool
Propose a new admin (two-step transfer, step 1).
fn propose_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)
Execute a previously proposed upgrade after the timelock has expired.
fn execute_upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Propose a timelocked upgrade.
fn propose_upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
Extend the TTL of a specific stream record.
Anyone can call this to keep a long-duration stream alive.
fn extend_stream_ttl(env: soroban_sdk::Env, stream_id: u64)
Get the total vested ("streamed") amount at the current time.
fn streamed_amount_of(env: soroban_sdk::Env, stream_id: u64) -> i128
Get the refunded amount.
fn get_refunded_amount(env: soroban_sdk::Env, stream_id: u64) -> i128
Get the deposited amount.
fn get_deposited_amount(env: soroban_sdk::Env, stream_id: u64) -> i128
Get the withdrawn amount.
fn get_withdrawn_amount(env: soroban_sdk::Env, stream_id: u64) -> i128
Get the refundable amount if the stream were canceled now.
fn refundable_amount_of(env: soroban_sdk::Env, stream_id: u64) -> i128
Get the amount withdrawable by the recipient.
fn withdrawable_amount_of(env: soroban_sdk::Env, stream_id: u64) -> i128