# Holder rewards

> Hold DEF and claim INFERENCE from the fees of the DEF pool.

DEF is the launch token. Trades in its configured Uniswap pool pay a fee, and flushes of that fee fund INFERENCE for DEF holders, apart from the addresses the token excludes. [Rewards](https://deference.si/rewards) shows the payouts and lets you claim your share as tokens or as service credit.

> **Where the program runs**
>
> Holder rewards run where the DEF token and hook are configured. Otherwise, [Rewards](https://deference.si/rewards) shows its availability notice.

## The program

| Rule             | Detail                                                                                                                                                                                                   |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Who receives     | Every wallet that holds DEF, except the system addresses the token excludes. The list is fixed when the token is deployed; on Hoodi it holds the pool manager, the hook and the other protocol contracts |
| What you receive | The INFERENCE each flush records as bought or minted for holders                                                                                                                                         |
| When             | Each time the hook flushes its fees. The keeper flushes once the interval has passed and the fees reach the minimum                                                                                      |
| Your share       | In proportion to your DEF balance while the INFERENCE is paid in. The token keeps a running total per share and rounds each share down                                                                   |
| Delivery         | Claim INFERENCE to your wallet, or activate it as service credit in one transaction. DEF transfers and other callers can also pay it to your wallet                                                      |

Nothing needs staking or locking, and there is no minimum holding. Your share accrues from the moment you hold DEF and stops when you send it away.

## How rewards work

1. Trades in the DEF pool pay its fee, which the hook collects.
2. Each flush records the ETH and DEF fees it collected, the USDC sent to the treasury and kept for holders, and the INFERENCE bought and minted for holders. [Rewards](https://deference.si/rewards) shows the treasury share and the pool fee under **Payouts**.
3. The hook pays that INFERENCE into the DEF token, which spreads it over every non-excluded holder by balance.

Your INFERENCE stays in the token's books until it is paid out. Every DEF transfer pays the sender and the receiver what they are owed; the token always does this. Anyone can also pay a list of wallets with `distribute`. Either way, INFERENCE can arrive in your wallet without a claim.

## Claim your rewards

Whatever is still owed to you, you can take with one of these actions:

* **Claim to wallet.** The token sends transferable INFERENCE to the wallet that holds the DEF.
* **Claim as credit.** The token activates the INFERENCE for service credit on the account that owns that wallet. The amount after the activation fee becomes service credit.

Reward INFERENCE is ordinary [INFERENCE](https://deference.si/docs/concepts/inference): activate it, keep it, send it, or sell it through the available market.

## Check the numbers

Every flush and every claim is a transaction on chain, so the explorer holds the whole record.

To check what a wallet is owed:

1. Open the DEF token in the explorer. **Contracts** on [Stats](https://deference.si/stats) links to it.
2. Under **Read Contract**, call `claimableOf` with the wallet address. The result is INFERENCE in six-decimal atoms, the amount **Claim to wallet** sends.
3. `accumulativeOf` is everything the token has assigned the wallet, `claimedOf` what it has already taken, and `isExcluded` whether the token skips it.

To check a payout, open its row's transaction from [Rewards](https://deference.si/rewards). The hook's `Flushed` event records the ETH and DEF fees collected, the USDC sent to the treasury and kept for holders, and the INFERENCE bought and minted. The token's `RewardNotified` event in the same transaction records the INFERENCE paid in.

For scripts, `GET /api/earn/<address>` answers with the wallet's `claimable`, `claimed`, `accumulative`, `balance_wei` and `excluded`, the token totals, `hook_state` (the flush interval, the last and next eligible flush, the minimum, the pending quote, the fee, the treasury share and the flusher), `totals`, the last 48 `flushes` and the wallet's last 20 `claims`. `gas` estimates `claim()` when there is something to claim, and its `call` field says so, since a claim as credit (`claimAndActivate`) costs more. The route answers `not_configured` on a chain without the DEF program, and `chain_unavailable` with status 503 when the wallet's balances could not be read from the chain, so an unread wallet is never reported as holding or owed nothing.
