---
name: berry-juicer
description: Earn AI inference from idle token supply on Robinhood Chain. Use when a user or agent wants to put unused token supply to work ("juice my tokens"), deposit a supported token into a single-sided yield vault, check inference balance earned from a Berry Juicer position, spend inference through an OpenAI-compatible endpoint, or withdraw principal and close a position. Single-sided Uniswap V4 LP via Berry Finance; fees auto-convert to USDG and 80% becomes the depositor's AI inference balance.
---

# Berry Juicer — Agent Skill

Put idle token supply to work and receive AI inference in return. Berry Juicer
deploys one isolated vault per position. Agents use the same factory, vaults, and
API as humans, with no agent-specific path.

Chain: Robinhood Chain mainnet (4663). Always read live addresses from `GET /api/config`.
The deposit factory is the `depositFactory` field, never hardcode it, it can
differ from the legacy factory when per-creator isolation is active.

## Concepts

- **Factory** — deploys one isolated **vault** per deposit. The creator triggers
  creation and pays the gas. Read its address from `config.depositFactory`.
- **Position vault** — a single position. It custodies only its own creator's
  principal and fees; positions are isolated from one another.
- **Principal** — the deposited supply (and any quote it converts into) belongs
  to the creator and is returned in full on withdraw.
- **Fees** — split on-chain: the **creator share** (80%) becomes the creator's
  **AI inference balance**, the **protocol margin** (20%) is retained. Harvested
  value settles in USDG.
- **Isolated inference** — when per-creator isolation is active, each creator's
  harvested USDG routes to their own dedicated wallet, and inference is paid from
  that wallet. Nothing is pooled across creators. The creator's balance is the
  USDG in their own wallet, not a shared pool.

## Status

Deposits are open. Read `GET /api/config` to confirm which tokens are enabled
before depositing: support is per token, and `supportedForDeposit` on
`GET /api/tokens/{address}/resolve` is the authoritative answer for one token.

## On-chain surface (verify without trusting the API)

Factory (`config.depositFactory`):
- `createVault(token, amount) -> vault` — deploy an isolated vault and deposit.
  Requires a prior ERC-20 approval of `amount` to the factory. Reverts for
  unsupported tokens.
- `vaultsOf(creator) -> address[]` — all vaults a creator owns.

Vault (one per position):
- `harvest(minOut)` — operator or creator; collects fees, swaps to USDG,
  splits on-chain. `minOut` is the minimum USDG out, 6 decimals. Proceeds
  always route to the creator and protocol.
- `withdraw()` — creator only; settles fees, returns principal. Independent of
  every off-chain service; works even if the API and operator are offline.
- `position() -> (token, amount, open)`, `pendingFees() -> uint256`, `creator()`.

## API surface

Base URL: `https://api.berryfinance.site`

Read `GET /api/config` for live addresses before calling anything else. Do not
hardcode a contract address from this file: the config endpoint is the only
authoritative source, and it is the reason every address here is named by
field rather than by value.

Reads (no auth):
- `GET /api/config` — chain id, live addresses, `depositFactory`, supportedTokens.
- `GET /api/creators/{address}/balance` — credited / spent / remaining (USDG 6dp).
- `GET /api/creators/{address}/inference-wallet` — isolated wallet status, if any.
- `GET /api/tokens/{address}/resolve` — market data, pool params, supportedForDeposit.

Spend inference (wallet signature, no API keys):
- Sign `berry-inference:{your_address_lowercase}:{timestamp_ms}` (valid 5 minutes).
- `POST /api/inference/chat` with headers `x-berry-address`, `x-berry-timestamp`,
  `x-berry-sig` and an OpenAI-compatible body. The wallet's own USDG pays.

## Typical agent flow

1. `GET /api/config` for `depositFactory`, quote asset, supportedTokens.
2. Approve the token to `depositFactory`.
3. `createVault(token, amount)` to open an isolated position.
4. Fees accrue and harvest on-chain; the creator share lands as inference balance
   (the creator's own wallet USDG in isolated mode).
5. Spend: sign the inference message and `POST /api/inference/chat`.
6. `withdraw()` to exit anytime and reclaim principal.

## Delegation (optional)

An agent may spend on a creator's behalf without holding the position. The creator
signs `berry-delegate:{creator}:{agent}:{expiresAtMs}` once and POSTs it to
`/api/delegations`. The agent then signs its own inference message and adds
`x-berry-on-behalf-of: 0xCreatorAddress`. Delegation covers spending only;
withdrawals always require the creator's wallet.
