# Subscription Events

### StreamCreated

Emitted when a subscription is created.

```solidity
event StreamCreated(address indexed user, address indexed author, uint256 indexed encodedRates)
```

#### Parameters

* `user` (address, indexed): The subscriber's address
* `author` (address, indexed): The author's address
* `encodedRates` (uint256, indexed): The encoded subscription rates

#### Description

Emitted when a new subscription is created through the `subscribe` function.

#### Example

```javascript
// Listen for stream creation events
papayaContract.on("StreamCreated", (user, author, encodedRates) => {
  console.log(`Stream created: ${user} subscribed to ${author} with rates ${encodedRates}`);
});
```

### StreamRevoked

Emitted when a subscription is cancelled.

```solidity
event StreamRevoked(address indexed user, address indexed author, uint256 indexed encodedRates)
```

#### Parameters

* `user` (address, indexed): The subscriber's address
* `author` (address, indexed): The author's address
* `encodedRates` (uint256, indexed): The encoded subscription rates

#### Description

Emitted when a subscription is cancelled through the `unsubscribe` function.

#### Example

```javascript
// Listen for stream revocation events
papayaContract.on("StreamRevoked", (user, author, encodedRates) => {
  console.log(`Stream revoked: ${user} unsubscribed from ${author} with rates ${encodedRates}`);
});
```


---

# Agent Instructions: 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://docs.papaya.finance/protocol/events/subscription-events.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.
