> For the complete documentation index, see [llms.txt](https://autopilot-5.gitbook.io/autopilot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://autopilot-5.gitbook.io/autopilot/protocol/markdown/reward-processing-pipeline.md).

# Reward Processing Pipeline

Autopilot handles reward collection and distribution through a four-stage, fully on-chain process. The system is designed to ensure rewards are claimed, converted, and allocated efficiently, with no manual steps or off-chain dependencies.

***

#### Stage 1: Reward Claiming

At the end of each epoch, Autopilot claims all eligible rewards:

```solidity
solidityCopyEditvoter_contract.claimBribes(...);
rewards_distributor.claim(...);
```

* **Bribe and fee rewards** are claimed from gauge contracts.
* **Rebase rewards**, if available, are claimed from the Aerodrome `RewardsDistributor`.

Claims are executed per NFT and handled in batches by the protocol.

***

#### Stage 2: Token Aggregation

After rewards are claimed, tokens are aggregated before swap execution:

* Tokens are first held by the main Autopilot contract.
* `fillSwapper()` transfers all reward tokens to the `SwapperV1` contract.

This reduces redundant transactions and prepares the rewards for efficient conversion.

***

#### Stage 3: USDC Conversion

Claimed tokens are converted to USDC:

* `SwapperV1` routes each token through the most efficient on-chain DEX path.
* Slippage controls and MEV protections are applied during swap execution.
* Converted USDC is sent to the `RewardsVault`.

This standardizes rewards and removes token volatility before distribution.

***

#### Stage 4: Proportional Distribution

User rewards are calculated based on their voting power relative to the total:

```solidity
solidityCopyEdituser_reward = (user_voting_power * total_rewards) / total_voting_power;
```

* Distribution is proportional to each user’s vote weight.
* Rewards are unaffected by deposit timing, assuming it occurred outside the Special Window.
* No manual adjustments or overrides are possible.
* A scaled accumulator system ensures full precision.

***

### 🔐 RewardsVault & Claiming

* All rewards are held in the `RewardsVault` until claimed.
* Users can claim USDC at any time, outside the post-epoch Special Window.
* Claims are processed with a single transaction per wallet.

***

#### Key Properties

* **Fair**: Rewards are based strictly on voting power
* **Consistent**: Behavior is deterministic and contract-enforced
* **Efficient**: Execution is optimized for batching and gas usage

> Autopilot turns raw protocol rewards into stable USDC — fully automated, on-chain, and proportional.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://autopilot-5.gitbook.io/autopilot/protocol/markdown/reward-processing-pipeline.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
