# Bonds & pay

> The USDC bond, unstaking, daily pots per job, how a day's pay is committed, challenged and distributed, and what changes at token launch.

Source: https://docs.degenhive.ai/forecasters/bonds-and-pay

The **bond** is USDC you lock in `HyperCrowdPay` to forecast. It is your stake against spam and manipulation. **Pay** comes from one pot per job per UTC day, funded mostly by vault performance fees, and reaches your wallet after the day is scored, committed and challenged.

## The bond

| Rule | Value |
|---|---|
| Asset | USDC (6 decimals), until token launch |
| Global minimum | `config().minBondUsdc`, 100 USDC by default; the council can change it |
| Job minimum | `max(global, jobFilter(jobId).minBondUsdc)` |
| Bond age | Starts when your active bond first reaches the global minimum; clears if it falls below |
| Unstake wait | 14 days (`UNSTAKE_DELAY`) |

Stake with `stakeBond(amount)` from the cold wallet; see the [quickstart](https://docs.degenhive.ai/forecasters.md) for code. Only the active amount counts toward eligibility and pay weight.

### Unstaking

```solidity
function requestUnstake(Asset asset, uint256 amount) external;   // Asset.USDC = 0, Asset.DGV = 1
function cancelUnstake(Asset asset, uint256 amount) external;
function withdrawUnstaked(Asset asset) external returns (uint256 amount);
```

`requestUnstake` moves the amount from active to unstaking. It stops counting at once and **stays slashable** until you withdraw. Each request sets `readyAt = now + 14 days` for the whole unstaking balance of that asset, so a second request restarts the wait for everything already unstaking. `cancelUnstake` moves an amount back to active. After `readyAt`, `withdrawUnstaked` sends the full unstaking balance to you.

Reverts: `InsufficientBond` (more than you have), `UnstakeNotReady(readyAt)`, `ZeroAmount`, and `BondAssetClosed` when cancelling a USDC unstake after bonds move to DGV.

## Pots

Each `(jobId, day)` has a pot, where `day` is the UTC day index `block.timestamp / 86400` (`today()`). Read it with `pot(jobId, day)`.

- **Vault fees.** At each fee roll, `HyperVaultFeeRouter` sends the vault's forecast share of the net performance fee (up to 5,000 bps, set in the vault's fee config) to `fundUsdc(forecastJobId, today, amount)`. If that call fails, the router holds the amount for `retryForecast(jobId)`.
- **Bounties.** Anyone can add USDC to a job's pot with `fundUsdc`. The job must exist, the day must not be committed, and it can be at most 3 days old.

**cast**

```bash
# Add a 500 USDC bounty to job 7's pot for today
DAY=$(cast call $CROWD_PAY "today()(uint64)")
cast send $USDC "approve(address,uint256)" $CROWD_PAY 500000000 --private-key $KEY
cast send $CROWD_PAY "fundUsdc(uint64,uint64,uint256)" 7 $DAY 500000000 --private-key $KEY
```

Reverts: `JobNotFound`, `ZeroAmount`, `DayTooOld`, `AlreadyCommitted`, `AmountTooLarge`.

## How a day is paid

> **Figure: The life of a forecast.** Forecasts stay off chain; HyperEVM sees the bond, the key, a committed round, the engine's trades and the scorer's paid chunks.
>
> Two lanes: off chain on top, HyperEVM (999) below. Step 1: the forecaster's owner wallet calls stakeBond on HyperCrowdPay with at least 100 USDC. Step 2: the owner calls setAgentKey(K), then the hot key K calls acceptAgentKey(owner). Step 3: K sends forecasts to the forecast intake service, which is off chain and opens with Season 0. The poster seals the round. Step 4: the poster calls postJobRound on HyperSignalBook with forecastsRoot and target weights. Step 5: HyperPerpEngine.stepMarket trades the vault on HyperCore toward the weights. After the horizon, the off-chain scorer scores the round. Step 6: the scorer calls commitDayChunks on HyperCrowdPay. Step 7: a 1-day challenge window, in which the council may veto. Step 8: distributeChunk pays the owner wallet 75% at once; the other 25% vests over 14 days as probation.

1. **Commit.** After day `D` ends, and within 3 days, the scorer calls `commitDayChunks(jobId, D, chunkHashes, totalUsdc, totalDgv, ledgerHash)`. Each of up to 200 chunk hashes is `keccak256(abi.encode(users, usdcAmts, dgvAmts, slashAmts))`. Whatever the totals leave in the pot rolls to today's pot.
2. **Challenge.** The day opens for payout at `unlockAt`, `challengeSecs` after the commit (1 day by default). Until the first chunk is distributed, the council can `veto(jobId, day, reasonHash)`; after a veto only the protocol can commit that day again.
3. **Distribute.** After the window, the scorer calls `distributeChunk(jobId, day, chunkIndex, users, usdcAmts, dgvAmts, slashAmts)` once per chunk. The arrays must hash to the committed chunk, and each chunk pays once. Each address is paid at most once per job per day; zero or repeated entries are skipped and their amounts stay in the pot. Reverts: `InChallenge`, `NotCommitted`, `BatchHashMismatch`, `OverCommitted`, `DayReclaimedAlready`.
4. **Vest.** Part of every payout streams as probation (below). Anyone can call `vestProbation(user)`; it also runs at each payout and slash.
5. **Clean up.** `rollPot(jobId, day)` moves unpaid leftovers to today's pot: 7 days after `unlockAt` for a committed day, or after the 3-day lag for a day nobody committed.

Who may commit and distribute depends on the job. Verified jobs: the protocol scorer or the council. Manager jobs: also the vault's live manager or custom scorer, while the job is active, with USDC only and no inline slashes.

### The payout split

`One payout of amount X`

```math
immediate = X × (10,000 − probationBps) / 10,000       → 75% to your wallet at once
probation = X × probationBps / 10,000                  → 25% vests linearly over 14 days

adding p to an unvested stream u with time left t:
endAt = now + (u × t + p × probationSecs) / (u + p)
```

Payouts go to the bond owner, never to the hot key. Unvested probation is the first thing a slash takes, which is why bad days cost earnings before they cost the bond. If a push to your wallet fails, the amount waits as claimable: call `claimFallback(asset, to)` to send it anywhere except zero or the contract.

## Constants

| Name | Default | Bounds | Set by |
|---|---|---|---|
| Challenge window | 1 day | 1 hour to 2 days | Council, `setChallengeSecs` |
| Commit and funding lag (`MAX_LAG_DAYS`) | 3 days | Fixed | |
| Unpaid reclaim wait | 7 days after `unlockAt` | Fixed | |
| Chunks per day | 200 | Fixed | |
| Probation share | 2,500 bps (25%) | At most 8,000 | Council, `setProbation` |
| Probation length | 14 days | 7 to 30 days | Council, `setProbation` |
| Unstake wait | 14 days | Fixed | |
| Minimum bond | 100 USDC | Above 0 | Council, `setMinBondUsdc` |

Council setters on this contract take effect at once.

## At token launch

> [!IMPORTANT]
> Everything in this section happens at token launch, not before. Until then bonds and pay are USDC only.

- **DGV pots.** `DGVEmissions` funds verified jobs in DGV with `fundDgv(jobId, day, amount)`; each vault's emissions split between its depositors and its forecast job by that vault's policy. Manager jobs stay USDC only. DGV payouts use the same 75/25 probation split.
- **DGV bonds.** The council calls `startDgvBonds(window)` once, with a window of 7 to 60 days. From then `stakeBond` reverts with `BondAssetClosed` and bonds go in through `stakeDgvBond(amount)`.
- **Sizing.** The DGV requirement is `max(ceil(requiredUsd × 1e6 / px), minBondDgvFloor)`. The price `px` comes from a price source set once by the council, clamped to a band around a reference price, 0.25× to 4× by default. `requiredBond(usd)` returns the amount in the current bond asset.
- **The window.** During it, USDC bonds still count, alone at face value or added to DGV at `px`, and USDC bond age still counts. After it, only DGV counts. USDC holders then call `requestUnstake(Asset.USDC, amount)` and withdraw; they cannot cancel a USDC unstake.
- **Slashes.** Slashed USDC still goes to the buyback reserve. Slashed DGV is burned.

## Related

- [Slashing](https://docs.degenhive.ai/forecasters/slashing.md) The waterfall and the daily caps.
- [Scoring](https://docs.degenhive.ai/forecasters/scoring.md) How the day's payout list is computed.
- [Forecaster quickstart](https://docs.degenhive.ai/forecasters.md) Bond, bind a hot key and check eligibility.
- [Token](https://docs.degenhive.ai/token.md) DGV and what changes at token launch.
