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

# Collateral Events

> Real-time pUSD deposit and withdrawal events (V2)

The collateral channel (`"collateral"`) streams pUSD wrap/unwrap events - deposits and withdrawals of the V2 trading collateral. This channel is opt-in and separate from the activity channel.

<Note>
  Collateral events are **V2-only**. Users depositing via USDC.e on V1 won't appear here. Subscribe to the [activity channel](/websocket/activity) for V1 collateral flows via split/merge/redeem.
</Note>

## Subscribe

```json theme={null}
{
  "action": "subscribe",
  "platform": "polymarket",
  "version": 1,
  "type": "collateral",
  "filters": { "users": ["0x3b27d0fb..."] }
}
```

### Filter Types

| Filter           | Description           | Example                    |
| ---------------- | --------------------- | -------------------------- |
| `users`          | Wallet addresses      | `["0x123...", "0xabc..."]` |
| Wildcard `["*"]` | All collateral events | `{"users": ["*"]}`         |

<Note>
  `condition_ids`, `market_slugs`, and `token_ids` are **not supported** - collateral flow isn't tied to a specific market.
</Note>

***

## Event Types

### polyusd\_wrapped

A user deposited underlying collateral (e.g. USDC.e) and received pUSD.

```json theme={null}
{
  "type": "event",
  "subscription_id": "sub_xxx",
  "data": {
    "event_type": "polyusd_wrapped",
    "user": "0x3b27d0fb...",
    "asset": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
    "amount": 45000000,
    "amount_normalized": 45,
    "tx_hash": "0x...",
    "log_index": "0x9ed",
    "block_number": "0x51c9418",
    "timestamp": 1776638042,
    "version": 2
  }
}
```

### polyusd\_unwrapped

A user burned pUSD and received underlying collateral back.

```json theme={null}
{
  "type": "event",
  "subscription_id": "sub_xxx",
  "data": {
    "event_type": "polyusd_unwrapped",
    "user": "0x3b27d0fb...",
    "asset": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
    "amount": 10000000,
    "amount_normalized": 10,
    "tx_hash": "0x...",
    "log_index": "0x3a2",
    "block_number": "0x51c9500",
    "timestamp": 1776638200,
    "version": 2
  }
}
```

***

## Field Reference

| Field               | Type                                         | Description                                                  |
| ------------------- | -------------------------------------------- | ------------------------------------------------------------ |
| `event_type`        | `"polyusd_wrapped"` \| `"polyusd_unwrapped"` | Wrap = deposit, Unwrap = withdrawal                          |
| `user`              | string                                       | End-recipient of the operation                               |
| `asset`             | string                                       | Underlying ERC-20 address (typically USDC.e `0x2791bca1...`) |
| `amount`            | number                                       | Raw amount (6 decimals, same as USDC)                        |
| `amount_normalized` | number                                       | Human-readable amount                                        |
| `tx_hash`           | string                                       | Transaction hash                                             |
| `log_index`         | string                                       | Log index within the transaction (hex)                       |
| `block_number`      | string                                       | Block number (hex)                                           |
| `timestamp`         | number                                       | Unix timestamp in seconds                                    |
| `version`           | number                                       | Always `2`                                                   |

***

## Example: Tracking Wallet Deposits

```javascript theme={null}
ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);

  if (msg.type === 'event' && msg.data.event_type === 'polyusd_wrapped') {
    const data = msg.data;
    console.log(`Deposit: $${data.amount_normalized} from ${data.user}`);
    console.log(`Asset: ${data.asset}`);
    console.log(`Tx: ${data.tx_hash}`);
  }

  if (msg.type === 'event' && msg.data.event_type === 'polyusd_unwrapped') {
    const data = msg.data;
    console.log(`Withdrawal: $${data.amount_normalized} to ${data.user}`);
  }
};
```
