---
name: fides-credit
description: Borrow small stablecoin working capital on Elysium through a Fides credit line, and repay it on time from earned revenue to grow the line. Use when an on-chain task (gas, AMM trade, paid API call) needs more stablecoin than the agent holds right now and it expects revenue before the due date.
---

# Fides credit line

You have a Fides credit line: a small, backer-secured stablecoin loan you can draw yourself, inside limits your owner set on chain. Repay on time and the line grows. Default and the line resets to zero, and the people who backed you lose money.

## Tools

Use the Fides MCP server. Run the local server (`npm run mcp:stdio -w api`, holding your controller key) to sign; the hosted one at `/mcp` reads freely and returns unsigned transactions for writes.

| Tool | Use it to |
| --- | --- |
| `check_line` | See your score, limit, open loan, due date and what you can draw. **Call this first, every time.** |
| `pool_status` | Check pool liquidity before a large draw. |
| `draw` | Borrow. Args: `creditId`, `amount` in dollars, `term` (`1d`, `7d`, `30d`). |
| `repay` | Pay back. Omit `amount` to repay in full. Fee is taken first, then principal. |
| `prove_score` | Give one counterparty a signed proof of your record without making it public. |
| `prove_zk_score` | Private lines: prove "score ≥ X, zero defaults" without revealing which line is yours (local server, about a minute). |
| `verify_score_proof` | Check a ZK score proof someone sent you. |

REST equivalents: `GET /api/line/:creditId`, `POST /api/draw`, `POST /api/repay` (relayed), `POST /api/reveal`.

## When to borrow

Borrow only when **all** of these hold:

1. A concrete task needs the funds now (gas, an AMM trade, a paid API call), and you are short.
2. You expect revenue from that task, or from work already in flight, **before the due date**.
3. The fee is worth it: 1% per 30 days, pro rata. $10 for 7 days costs about $0.023.
4. The amount is the shortfall, not the full limit. Draw what you need.

Do **not** borrow to repay another Fides loan, to speculate with money you can't repay if the trade loses, or because the limit is available.

## Picking a term

Pick the shortest term that safely covers your revenue cycle. `1d` for same-day turnarounds, `7d` for weekly settlements, `30d` only when revenue is genuinely monthly. Fees accrue by the second, so repaying early is always cheaper.

## Repaying

- Repay **before `dueAt`** from earned revenue. After `dueAt` there is a 3-day grace; repaying in grace closes the loan but earns no score.
- After `dueAt + 3 days` anyone can flag a default: your backers are slashed, your score drops to 0, and the default is recorded permanently.
- If you can only pay part, pay part: it reduces what you owe and the fee that accrues.
- **Score weight:** a repayment funded by a third party (a customer paying you, revenue landing from elsewhere) scores **+50**. A repayment from your own wallets, payout address or the relayer scores **+10**. Don't try to fake third-party funding by looping your own money; the owner's wallets are registered as self wallets.

## Private lines

If your line is private (`mode: "private"`):

- Draws pay out to a **one-time stealth address** derived from your stealth meta-address. Recover its key with your viewing and spending keys (`computeStealthPrivateKey` in the SDK).
- **Never repay from your main wallet.** That links the loan to you on chain. Repay from the stealth address through the relayer: sign a permit plus a RepayAuth (`signRelayedRepay` in the SDK) and `POST /api/repay`. The stealth address needs no gas.
- Private mode hides *who* borrowed, not *how much*: amounts and timing are public.
- To show your record to one counterparty, use `prove_score` with their address. Nobody else can link it to you.
- To prove you're creditworthy **without** revealing which line is yours, ask the counterparty for their address and a nonce, then call `prove_zk_score` with a threshold at or below your score. Send them the JSON it returns. It works only if your line has never defaulted.

## Limits

Your owner's policy caps the maximum single draw, the allowed terms and an expiry date. A draw outside it reverts. Ask your owner to change the policy; don't work around it.

Tier caps grow with score: $5 → $25 → $50 → $100 → $250 → $500. Private lines need more score per tier.
