Skip to content

gussulliman/cache-protocol

Repository files navigation

cache.

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


The idea

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-consumptionhave 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.

How it uses each sponsor's tech

  • 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 Account 0x12f66323B50F10f51b1D69E1B9FcF1E6668d109A.
  • 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 /inference proxy mirrors Venice's OpenAI-compatible API across ~90 text models.

Architecture

[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

Live on Base mainnet

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.

Repo layout

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

Develop (fresh clone)

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

Quality & safety

  • 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 renounceOwnership is 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.

Smart Accounts Kit Usage

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.

Advanced Permissions (ERC-7715)

Delegations (ERC-7710)

Redelegation

Not used — delegations are single-hop (Smart Account → 1Shot session key), redeemed directly by the relayer.

x402

Not used — cache. is a vault layer, not an agent-to-agent payment flow.

1Shot API Usage

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).

Venice AI Usage

The vault's entire yield is real, resold Venice inference; depositors self-consume their share through an OpenAI-compatible proxy.

Feedback

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} + a TimestampEnforcer). 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.transfer bundled 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's gasUsed returns 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.

Social Media

  • Launch thread (X): add your post URL here

Honest guardrails

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.

About

An ERC-4626 DIEM vault on Base that resells idle daily Venice inference credit and compounds it back into DIEM — gasless via MetaMask Smart Accounts + 1Shot. Built for the MetaMask × 1Shot × Venice AI Dev Cook-Off.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors