Contract Address
Testnet:CAZSE5UHSWNF62K26OZKOL7BSFB2647CXRPOICHUDCUJ5EKS4NCOA6ZA
Key Functions
For Clients
Creates a new payment stream and immediately locks the client’s funds in the contract. Returns the new
stream_id.Parameters:sender— The client’s Stellar address (must authorize)recipient— The worker’s Stellar addressrate_per_second— Payment rate in stroops per secondasset— Token contract address (USDC or XLM)total_deposited— Total amount to lock in escrow (stroops)duration_ledgers— Stream duration in Stellar ledgerscheckpoint_count— Number of payment checkpoints (1–30)withdrawable_cap_percent— Percentage of earned funds releasable before checkpoint approvalapproval_timeout_ledgers— Ledgers before a pending request auto-releasescategory— Work category (Freelance,Salary,Bounty,Grant,AgentTask,Subscription)title— Human-readable stream name (max 80 bytes)
Pauses an active stream, freezing the payment clock. Only the sender (client) may call this. The stream accumulates
paused_duration_ledgers so that elapsed time is tracked accurately on resume.Parameters:stream_id— ID of the stream to pausecaller— Must match the stream sender
Resumes a paused stream and restarts the payment clock from where it stopped. Only the sender may call this.Parameters:
stream_id— ID of the stream to resumecaller— Must match the stream sender
Cancels an active or paused stream. Earned-but-unpaid funds are transferred to the worker immediately; remaining unearned funds are refunded to the client.Parameters:
stream_id— ID of the stream to cancelcaller— Must match the stream sender
Explicitly approves a pending withdrawal request, allowing the worker to claim funds without waiting for the auto-release timeout.Parameters:
stream_id— ID of the streamsender— Must match the stream senderrequest_id— The withdrawal request identifier
Marks a pending withdrawal request as disputed, preventing auto-release and freeing the reserved funds back into the withdrawable pool.Parameters:
stream_id— ID of the streamsender— Must match the stream senderrequest_id— The withdrawal request identifier
Explicitly approves a submitted checkpoint, triggering immediate finalization and attestation minting. Returns the new
attestation_id.Parameters:stream_id— ID of the streamsender— Must match the stream senderindex— Zero-based checkpoint index
For Workers
Submits a withdrawal request for a completed work period. Only available when no verifier is configured on the contract. When a verifier is set, use the dashboard flow instead — the verifier calls
verify_work on your behalf.Parameters:stream_id— ID of the streamrecipient— Must match the stream recipient (must authorize)request_id— Unique string identifier for this request (max 64 bytes)amount— Amount to request in stroops
Executes an approved (or auto-released) withdrawal, transferring tokens to the worker and minting an attestation atomically. Returns the amount transferred.Parameters:
stream_id— ID of the streamrecipient— Must match the stream recipient (must authorize)request_id— The approved withdrawal request identifier
Submits evidence for a checkpoint period, signalling to the client that work is ready for review.Parameters:
stream_id— ID of the streamworker— Must match the stream recipient (must authorize)index— Zero-based checkpoint indexevidence_hash— 32-byte SHA-256 hash of the work evidence
Verifier-Only (Dashboard)
Called by the Aven dashboard’s verifier key after validating a work session report. Creates a
WithdrawalRecord with the verified evidence hash and reserves the funds for payout. The worker then calls withdraw_approved to complete the transfer and mint the attestation.Parameters:stream_id— ID of the streamrequest_id— Unique session identifier (max 64 bytes)amount— Verified payment amount in stroopsevidence_hash— 32-byte hash of the verified session reportactive_duration_seconds— Active working seconds in the sessionwork_start_ledger— Ledger sequence when the session started
Read Functions
Returns the full
StreamRecord for the given stream ID.Returns all stream IDs where the given address is the sender.
Returns all stream IDs where the given address is the recipient.
Returns the amount currently available for withdrawal — earned funds minus already-reserved pending requests.
Returns the total earned (withdrawable) amount for the stream based on elapsed active ledgers and checkpoint unlock status.
Returns the
WithdrawalRecord for a specific (stream_id, request_id) pair.Returns the
CheckpointRecord for a specific (stream_id, index) pair.Scans all elapsed checkpoint periods for the given stream and finalizes any that are unlocked (either explicitly approved or past the auto-approval timeout). Returns the number of checkpoints settled. Can be called by anyone.Parameters:
stream_id— ID of the stream to settle
StreamRecord Fields
TheStreamRecord struct is returned by get_stream. Its fields describe the full state of a payment stream.
Unique auto-incrementing stream identifier assigned at creation.
The client’s Stellar address — the account that funded the stream.
The worker’s Stellar address — the account that receives payments.
Payment rate in stroops per Stellar ledger, derived from the per-second rate at creation (
rate_per_second × 5).Token contract address for the streaming asset (USDC or native XLM).
Total amount locked in escrow at stream creation, in stroops.
Cumulative amount already paid out to the worker, in stroops.
Stellar ledger sequence number at which the stream was created.
Total stream duration in Stellar ledgers (approximately 5 seconds each).
Current lifecycle state:
Active, Paused, Completed, or Cancelled.Work category used to classify the attestations minted from this stream:
Freelance, Salary, Bounty, Grant, AgentTask, or Subscription.Human-readable stream name (max 80 UTF-8 bytes), stored on-chain and copied to every attestation.
Number of payment checkpoints dividing the stream duration (1–30).
Ledgers per checkpoint period (
duration_ledgers / checkpoint_count).Percentage of earned funds available before a checkpoint is approved (0–100). Acts as a client protection mechanism.
Number of ledgers a withdrawal request remains pending before it auto-releases without explicit client approval.
Ledger sequence when the stream was last paused.
0 when the stream is active.Cumulative ledgers the stream has spent in the
Paused state. Subtracted from elapsed time during payout calculations.Error Codes
Clients interact with the stream contract through the Aven dashboard, which handles wallet authorization and verifier coordination automatically. Direct contract invocation is possible via Stellar Lab or the Stellar CLI for advanced users who want to inspect or interact with streams programmatically.