SetloDocs

Architecture

Package lifecycle

Five onchain states and the money that moves at each transition.

States

Open ──(last required accept + funding; auto or clientConfirm)──▶ Confirmed
Open ──(deadline missed / final expiry)──▶ Expired
Confirmed ──(releaseBalances, or review window passed)──▶ Released
Confirmed ──(cancelAfterConfirm, before event date)──▶ Cancelled

Money by transition

TransitionCredited
ConfirmEach accepted slot's deposit to its supplier; agency fee to the agency; unaccepted optional slots back to the client
ReleaseEach booked slot's balance to its supplier
Cancel after confirmUnreleased balances back to the client
ExpireEarned hold fees to suppliers who accepted; the remainder to the client
Change that lowers the totalThe excess back to the client immediately

Invariant

Every unit funded is either still held for a package, credited to someone, or already claimed. Foundry invariant tests check that the contract's USDG balance always covers what it owes.