Skip to content

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

ContractFilePurpose
Poolcore/Pool.solStaking, capacity accounting, reserve, borrow, yield
Vaultcore/Vault.solHolds 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 limit

Pending 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:

SourceHow to get itResets
reservedreserve(amount)Never (until you change it)
purchasedpurchase(amount) — pay USDCEach UTC day
borrowedborrow(amount) — repaid via capacity lockEach UTC day

USDC yield

Revenue from purchase() flows into a sellPerShare accumulator (MasterChef pattern). Call claim() to collect accrued USDC at any time.

Released under the MIT License.