Liquidity layer
The liquidity layer handles DIEM staking and inference capacity allocation. It works independently of the agent launchpad — any wallet or contract can use it directly.
Contracts
| Contract | File | Purpose |
|---|---|---|
Pool | core/Pool.sol | Staking, capacity accounting, reserve, borrow, yield |
Vault | core/Vault.sol | Holds DIEM, drives Venice staking, manages unstake queue |
Flow
User
│ DIEM
▼
Pool.enter()
│ transfers DIEM directly to Vault
▼
Vault.notifyDeposit() → Venice stake()
│
▼
Pool tracks shares[user]
│
▼
Gateway reads capacityToday(user) → Venice API key limitPending entry
DIEM deposited today activates tomorrow. This matches Venice's own timing — stake today, capacity tomorrow. Your shares balance updates immediately; activeShares catches up at the next UTC day boundary.
Capacity sources
capacityToday(user) sums three independent buckets:
| Source | How to get it | Resets |
|---|---|---|
reserved | reserve(amount) | Never (until you change it) |
purchased | purchase(amount) — pay USDC | Each UTC day |
borrowed | borrow(amount) — repaid via capacity lock | Each UTC day |
USDC yield
Revenue from purchase() flows into a sellPerShare accumulator (MasterChef pattern). Call claim() to collect accrued USDC at any time.