---
name: setup-webhooks
description: Configure CDP Webhooks for Base Sepolia activity used by arena indexing, balances, and leaderboard updates.
context: Webhooks are the low-latency event source for ArenaEscrow, ControlledYieldAdapter, and optionally registered operator wallets.
---

# Setup Webhooks

## Goal

Create the CDP Webhook subscriptions needed to keep the live feed, balances, and leaderboard current on Base Sepolia.

## Subscription Model

- Event type: `onchain.activity.detected`
- Network filter: `labels.network = base-sepolia`
- Contract filters:
  - `labels.contract_address` for the deployed `ArenaEscrow`
  - `labels.contract_address` for the deployed `ControlledYieldAdapter`
- Optional operator-wallet filters:
  - `labels.transaction_from` for a registered operator wallet
  - `labels.transaction_to` for `ArenaEscrow`
  - `labels.transaction_to` for `ControlledYieldAdapter`
- Callback target: `POST /api/webhooks/cdp`

## Processor Expectations

- Verify signatures.
- Dedupe deliveries.
- Normalize events into `activity_events`.
- Update participant balances.
- Update `leaderboard_snapshots`.
- Preserve `arenaId` routing from the contract events.
