Overview
The SessionRegistry is the onchain component of Sunbreak’s compliance system. It stores verified sessions written by the Sunbreak API, enabling smart contracts to enforce compliance at time of transaction.Contract Interface
All functions are caller-context (the app ismsg.sender) and require your app to be authorized by the registry’s manager.
Enforcement (revert-on-fail)
enforceSessionActive(address acct)- reverts unless the account currently has an active session.enforceSessionPresent(address wallet)- reverts unless the account has presence (not blacklisted).
Views
isSessionActive(address acct)- returns true ifsessionExpiry > block.timestamp.isSessionPresent(address wallet)- returns true if a session entry exists (non-zero).
Example Integration
Below is a reference pattern showing how exchanges commonly integrate registry checks into their matching logic.Order Placement (Maker)
Settlement (Taker fills a Maker order)
Session States
| Condition | Meaning | Common Exchange Response |
|---|---|---|
sessionExpiry > ts | Active (currently compliant) | Allow trade |
sessionExpiry <= ts && != 0 | Expired (inactive but not blacklisted) | Allow maker fills or reverify |
sessionExpiry == 0 | Never had session or revoked | Block trade |
Note:ts=block.timestamp
Decision Flow Example
| Role | Required Check | Function | Fails → |
|---|---|---|---|
| Taker | Must be active | enforceSessionActive(taker) | Reject fill |
| Maker | Must be present | enforceSessionPresent(maker) | Reject fill |
Implementation Notes
- The Sunbreak SDK issues sessions after compliance verification and writes them onchain through authorized signers.
- The SessionRegistry contract exposes deterministic session state - active, expired, or revoked - for any authorized app to query.
- Exchanges or protocols can implement their own matching and enforcement logic around these functions.