---
name: arkberry-juicer
description: Earn AI inference from idle token supply on Arc. 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 an ArkBerry Juicer position, spend inference through an OpenAI-compatible endpoint, or withdraw principal and close a position. Single-sided Uniswap V4 LP via ArkBerry Finance; fees auto-convert to USDC and 80% becomes the depositor's AI inference balance.
---

# ArkBerry Juicer: Agent Skill

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

Chain: Arc mainnet, chain id 5042. Gas is paid in USDC; Arc has no ETH.
RPC: `https://rpc.mainnet.arc.io`. Block explorer: `https://explorer.arc.io`.

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, in USDC. 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**, and the **protocol margin** (20%) is retained.
  Harvested value settles in USDC.
- **Isolated inference**: when per-creator isolation is active, each creator's
  harvested USDC routes to their own dedicated wallet, and inference is paid from
  that wallet. Nothing is pooled across creators. The creator's balance is the
  USDC 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 USDC,
  splits on-chain. `minOut` is the minimum USDC 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

API host: `https://api.arkberry.finance` (planned host; the API is not answering there yet).

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 (USDC 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 `arkberry-inference:{your_address_lowercase}:{timestamp_ms}` (valid 5 minutes).
- `POST /api/inference/chat` with headers `x-arkberry-address`, `x-arkberry-timestamp`,
  `x-arkberry-sig` and an OpenAI-compatible body. The wallet's own USDC 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 USDC 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 `arkberry-delegate:{creator}:{agent}:{expiresAtMs}` once and POSTs it to
`/api/delegations`. The agent then signs its own inference message and adds
`x-arkberry-on-behalf-of: 0xCreatorAddress`. Delegation covers spending only;
withdrawals always require the creator's wallet.
