> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anvil.markets/llms.txt
> Use this file to discover all available pages before exploring further.

# How compounding works

> Eligible rewards buy more of your coin, within your permission.

A reward pair has two assets: the **coin you want more of** and the **reward token you receive**. ANVIL reinvests the second into the first. The upstream project supplies the rewards; ANVIL does not create payouts or promise a return.

<Steps>
  <Step title="Protect your starting balance">
    At setup, the reward tokens already in your account become your protected floor. You approve a finite allowance and an expiry. Your principal coin remains in your wallet.
  </Step>

  <Step title="Let eligible rewards accumulate">
    The keeper checks for rewards above the floor. The planned trigger is about \$5, subject to your own threshold, remaining allowance, pricing checks, and available swap routes.
  </Step>

  <Step title="Swap and receive">
    When the checks pass, the keeper submits a compound. Eligible rewards are swapped for your selected coin and delivered to your own token account. ANVIL pays the compound transaction's gas.
  </Step>

  <Step title="Repeat within your limits">
    Compounding continues while the permission is valid and allowance remains. You can change your rules or revoke permission.
  </Step>
</Steps>

## What the floor means

The floor protects a **number of reward tokens**, not a dollar value. If you start with 10 reward tokens and later receive 3, only the balance above 10 is eligible, subject to your other rules. Token prices can still fall.

## One transaction

The program checks the protected balance and required output as part of an atomic transaction. If a required check fails, the transaction's state changes revert. The transaction payer can still pay a network fee for a failed transaction.

See [fees](/protocol/fees), [permissions](/compounding/manage-and-stop), and [security](/protocol/security).
