Skip to content

Security Assurance

The escrow contract is backed by a comprehensive automated test suite that verifies correctness, security, and edge case handling. The suite contains 50+ individual tests covering every fund flow, access control rule, and failure scenario.

What Is Tested

Fund Locking (Deposits) — 6 tests

Verifies that deposits are recorded correctly and that invalid deposits are rejected.

ScenarioWhat Is Verified
Standard depositFunds are locked and recorded with the correct amount, currency, and depositor
Stablecoin depositToken transfer completes and deposit is recorded accurately
Zero amount rejectedThe contract refuses to accept a deposit of zero value
Invalid token rejectedThe contract refuses deposits with invalid currency identifiers
Unapproved transfer rejectedThe contract refuses token deposits that haven't been pre-approved

Budget Allocation — 12 tests

Verifies that allocations are created correctly, that access controls are enforced, and that over-allocation is prevented.

ScenarioWhat Is Verified
Single-slot allocationAllocation is created with correct terms
Multi-slot equal payoutsBudget is split equally across slots
Variable payoutsDifferent per-slot amounts are committed correctly
Multiple streamersSeveral streamers can be allocated from the same deposit
Non-depositor blockedOnly the original depositor can create allocations
Over-allocation blockedThe contract prevents allocating more than the available balance
Past deadline blockedAllocations cannot be created with already-expired deadlines
Duplicate streamer blockedThe same streamer cannot receive two allocations from one deposit

Payout Claims — 15 tests

Verifies that valid claims result in payment, invalid claims are rejected, and double-claiming is prevented.

ScenarioWhat Is Verified
Valid single claimStreamer receives correct amount for a completed slot
Valid claim (native currency)Payout works for both stablecoins and native currency
Out-of-order claimsSlots can be claimed in any order
All slots claimedAllocation is marked complete when every slot is paid
Invalid proof rejectedWrong proof of fulfillment is rejected — no payout
Wrong amount rejectedClaiming a different amount than committed is rejected
Double claim blockedThe same slot cannot be claimed twice
Completed allocation blockedNo further claims accepted after all slots are paid

Batch Claims — 8 tests

Verifies that multi-slot claims in a single transaction work correctly.

ScenarioWhat Is Verified
Batch all equal slotsAll slots claimed at once with equal amounts
Batch variable slotsAll slots claimed at once with different amounts
Partial batchSubset of slots claimed in one batch
Mixed batch and singleCombining single claims with batch claims
Empty batch rejectedThe contract refuses empty claim submissions
Duplicate in batch rejectedThe same slot cannot appear twice in one batch

Allocation Refunds — 8 tests

Verifies that operators can recover unclaimed funds correctly and that early refunds are blocked.

ScenarioWhat Is Verified
Full refundAll unclaimed funds returned when no slots were claimed
Partial refund (equal)Correct amount returned when some equal slots were claimed
Partial refund (variable)Correct amount returned when some variable slots were claimed
Early refund blockedRefund is rejected before the agreed deadline
Non-depositor blockedOnly the original depositor can trigger a refund
Completed allocation blockedCannot refund an allocation where all slots were already paid
Re-allocation after refundRefunded funds can be allocated to a new streamer

Deposit Refunds — 6 tests

Verifies that operators can withdraw unallocated balances and that double refunds are prevented.

ScenarioWhat Is Verified
Partial refundUnallocated balance returned to operator
Full refundEntire deposit returned when nothing was allocated
Native currency refundRefund works for native currency deposits
No balance rejectedRefund is rejected when all funds are allocated
Non-depositor blockedOnly the original depositor can withdraw
Double refund blockedCannot refund the same unallocated balance twice

End-to-End Lifecycle — 1 test

A comprehensive integration test that exercises the complete lifecycle:

Deposit → Allocate to 2 streamers → Partial payouts → Batch payout → Deadline passes → Allocation refund → Deposit refund

This test verifies that all stages interact correctly and that fund balances are accurate throughout the entire process.

Randomised Testing (Fuzz) — 3 tests

The contract is also subjected to fuzz testing, where hundreds of randomised inputs are used to verify correctness:

ScenarioWhat Is Verified
Random amounts and secretsSingle-slot claims work with arbitrary values
Random slot counts (1–32)Equal-payout allocations work for any number of slots
Random variable amounts (2–9 slots)Variable-payout allocations handle arbitrary per-slot distributions

Fuzz testing is designed to find edge cases that manual tests might miss — such as rounding errors, overflow conditions, or unexpected input combinations.

Verifluence Documentation