Idle capital, active inference.
An ERC-4626 DIEM vault on Base that resells your idle daily Venice inference credit across inference marketplaces and compounds the proceeds back into DIEM — while letting you spend your own share as free inference. Gasless, via MetaMask Smart Accounts + 1Shot.
Submission for the MetaMask × 1Shot × Venice AI Dev Cook-Off. Live: https://cache.puttowork.co
1 DIEM = ~$1/day of Venice API credit on top-tier models — but the credit is daily: whatever you don't use in 24h is gone. Most holders never use their full allowance, so productive capital evaporates every day.
cache. is the vault that puts it to work. Deposit DIEM, receive vDIEM. The
vault stakes the DIEM on Venice, resells the idle daily inference credit across
neutral marketplaces (Surplus Intelligence first), and swaps the USDC proceeds
back into DIEM. Your vDIEM claims a growing slice of the underlying — an index
fund for inference.
HYBRID self-consumption — have your cache and eat it too: instead of
selling all of your share, you can spend part of it yourself as free
inference, metered against your vDIEM share through an OpenAI-compatible API.
Whatever you don't spend stays in the sell-side path and still earns.
cache. is a vault layer only — it sells through neutral marketplaces and never becomes one. No buyer-side router, no inventory-plus-marketplace conflict.
- MetaMask Smart Accounts (ERC-7710 / ERC-7715) — the autonomous keeper
and seller are MetaMask Smart Accounts. Authority is granted via scoped,
time-boxed delegations, so the keeper can compound and nothing else — no admin
escape hatch, no broad approvals. Verified live:
vault.keeper()returns the Smart Account0x12f66323B50F10f51b1D69E1B9FcF1E6668d109A. - 1Shot — keeper/seller operations are relayed through the 1Shot public relayer
with gas paid in USDC in-band, so depositors and the agent never need ETH. A
real, settled, gasless harvest:
0x37e1…77a45— the 1Shot relayer is the sender, the harvest executes as the Smart Account, and the fee is paid in USDC. - Venice — DIEM is staked on the public Venice contract; the vault's entire
yield is real, resold Venice inference. The
/inferenceproxy mirrors Venice's OpenAI-compatible API across ~90 text models.
[User] → deposits DIEM → DiemVault (ERC-4626, Base) → auto-stake on Venice
[Seller — MetaMask Smart Account] → lists Venice models on marketplaces,
payout_address = the vault
[Buyer] → request → marketplace → Venice (vault's key) → settle USDC → vault
[Keeper — MetaMask Smart Account] → harvest() relayed via 1Shot (gas in USDC)
→ swap USDC → DIEM on Aerodrome SlipStream (on-chain slippage floor)
→ re-stake → vDIEM:DIEM rate rises
[Depositor] → /inference → SIWE once → API key → free inference up to vDIEM share
[User] → requestRedeem → flush → cooldown → claimRedeem
| Contract | Address |
|---|---|
| DiemVault (ERC-4626) | 0xa5A9…1cd2 |
| CacheSellerDelegation | 0x1da1…d31b |
| CacheUsageLogger | 0x6f0d…f369 |
| Keeper (MetaMask Smart Account) | 0x12f6…109A |
| Owner (Safe) | 0xC3E9…aaE2 |
Full, annotated list on the /contracts page.
contracts/ Foundry workspace — DiemVault, CacheSellerDelegation, CacheUsageLogger
keeper/ Autonomous keeper (MetaMask Smart Accounts + 1Shot relayer)
scripts/ Off-chain TS — relay-harvest, seller registration, dynamic pricer
proxy/ HYBRID inference proxy (Hono + SIWE + SQLite quota ledger)
web/ Next.js dapp (deposit, /inference, /contracts, manifesto)
docs/ Docusaurus documentation
npm install # root: activates the pre-commit hooks
# Contracts — dependencies are NOT vendored, install them first:
cd contracts
forge install foundry-rs/forge-std OpenZeppelin/openzeppelin-contracts@v5.6.1
forge build
forge test --fork-url https://mainnet.base.org # the suite forks Base mainnet
# Off-chain workspaces:
cd ../scripts && npm install && cp .env.example .env
cd ../proxy && npm install && cp .env.example .env
cd ../web && npm install && npm run dev- Foundry, proxy, and script test suites passing; Slither reports 0 high / 0 medium.
- Contracts are Safe-owned with no admin escape hatch — no emergency withdraw,
and
renounceOwnershipis disabled so the vault can't be bricked. harvest()is keeper-gated and enforces its USDC→DIEM slippage floor on-chain (1%, hard-capped at 5%).- Not formally third-party audited — ship behind a conservative deposit cap.
cache.'s keeper and seller are MetaMask Smart Accounts (Hybrid DeleGators). Authority is granted via ERC-7715 advanced permissions and scoped ERC-7710 delegations (compound-only, time-boxed), redeemed gaslessly by the 1Shot relayer.
- Request — keeper grant: scripts/grant-keeper-permission.ts
- Request — seller grant: scripts/grant-seller-permission.ts
- Redeem — carried as the Smart Account in the relayed user op: scripts/relay-harvest.ts#L183-L204, submitted via scripts/lib/oneshot.ts
- Create — scoped keeper+fee delegation (targets
{vault, USDC}, methods{harvest, transfer},TimestampEnforcerexpiry):createKeeperFeeDelegation— scripts/lib/smart-account.ts#L288 - Sign — signed by the Smart Account: scripts/sign-permission.ts ·
buildSignedPermissionContext— scripts/relay-harvest.ts#L243 - Redeem — the 1Shot relayer redeems the delegation through MetaMask's DelegationManager: scripts/relay-harvest.ts#L357. Settled on Base:
0x37e1…77a45
Not used — delegations are single-hop (Smart Account → 1Shot session key), redeemed directly by the relayer.
Not used — cache. is a vault layer, not an agent-to-agent payment flow.
Keeper/seller actions are relayed through 1Shot's permissionless relayer (relayer.1shotapi.com), with gas paid in USDC in-band (a USDC fee transfer bundled into the same user op, run as the Smart Account).
- 1Shot client — estimate / submit / status: scripts/lib/oneshot.ts
- Relayed gasless harvest — build, sign, estimate, submit: scripts/relay-harvest.ts
- Proof — real settled tx, gas paid in USDC: basescan.org/tx/0x37e1…77a45
The vault's entire yield is real, resold Venice inference; depositors self-consume their share through an OpenAI-compatible proxy.
- OpenAI-compatible
/chat/completionsforwarder to Venice: proxy/src/lib/venice.ts - Programmatic Venice API-key generation (ERC-1271 from the vault account): scripts/generate-venice-key.ts
/inferenceconsole — SIWE → key → use from any OpenAI client: web/app/inference/InferenceClient.tsx- Listing Venice models on the marketplace (seller): scripts/register-seller.ts
Building cache. end-to-end on all three SDKs surfaced concrete, constructive feedback:
- MetaMask Smart Accounts — the scoped ERC-7710 delegation model is the right primitive for a bounded autonomous agent (we lock the keeper to
{vault, USDC}×{harvest, transfer}+ aTimestampEnforcer). Sharp edge worth documenting: smart-account signatures are non-deterministic, which silently breaks sign-to-derive schemes — it broke our browser keystore for smart-account wallets, so we special-case them. - 1Shot — gasless execution with the fee paid in USDC is a great agent-UX primitive. The non-obvious part: the public relayer must be paid in-band (a
USDC.transferbundled with the action, run as the Smart Account) — a first-class doc/example would help. Minor: the estimate rejects a simulated fee below the per-token chain minimum ($0.01 USDC) with "Mock payment must be at least the chain minimum fee", and the estimate'sgasUsedreturns as an object that doesn't stringify ([object Object]). - Venice — DIEM → ~$1/day credit + an OpenAI-compatible API made the proxy a drop-in. More docs on headless / contract-account key generation (sVVV gate + ERC-1271 auth) would help vault/agent builders; we also hit a 25-model cap when advertising the ~90-model text catalogue.
- Launch thread (X): add your post URL here
No guaranteed yield — returns reflect real inference demand less costs. No token
sale; no $CACHE. Not investment advice. Not a substitute for self-custody.
Smart-contract, market, and protocol risk are real.
Built for the MetaMask × 1Shot × Venice AI Dev Cook-Off.