# Stream Scheduler

## What’s the Stream Scheduler?

The Stream Scheduler allows you to:

1. Schedule when an existing stream is to be closed
2. Schedule when to start a new stream
3. Schedule when to start a new stream and when that new stream is to be closed

This feature can be be used directly in the Superfluid Dashboard after getting [approved for access](https://use.superfluid.finance/schedulestreams) or by making use of the underlying contracts in conjunction with off-chain automations (detailed in documentation here).

## Why Schedule Streams?

If you have an intended end date and/or start date for a stream, instead of having to *manually* trigger the action, you could use the Stream Scheduler to *automatically* trigger the action at the desired time. This is especially useful in the case of streaming payroll, subscriptions and token vesting.

Superfluid streams are perpetual by default - they run until you cancel them or you run out of balance. If you want to be streaming someone tokens for a fixed duration and not have to deal with manually triggering the creation or deletion of the stream, the Stream Scheduler is the solution.

## Example:

(view these Miro diagrams [here](https://miro.com/app/board/uXjVP--AM4I=/?share_link_id=524959909457))

1\.  It’s January 1st. You give the Stream Scheduler contract [operator permissions](https://docs.superfluid.finance/superfluid/developers/constant-flow-agreement-cfa/cfa-access-control-list-acl) and then schedule a stream with the below details:

*Flow Rate*: 100 DAIx/mo.\
\&#xNAN;*To*: Alice’s account\
\&#xNAN;*Start*: March 1st, 2023 at 12:00am\
\&#xNAN;*End*: March 20th, 2023 at 12:00am

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2FitXBLkPAXsvgXry31XKe%2Fimage.png?alt=media&#x26;token=7b3843d0-e461-44bf-99df-9e1810e6ef33" alt=""><figcaption></figcaption></figure>

2\.  March 1st comes and the stream is initiated from you to Alice.

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2Fm5Vc3ONgbolqjlFfjbAx%2Fimage.png?alt=media&#x26;token=b22cf8ff-a1e9-4fd8-86c4-7d448e2989e5" alt=""><figcaption></figcaption></figure>

3\.  March 20th comes and the stream from you to Alice is cancelled.

<figure><img src="https://422548309-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKEcOOf_qoYMObicyRu%2Fuploads%2FcXtEO4pwVK0DjMJYqCpO%2Fimage.png?alt=media&#x26;token=2c1263da-88f7-4c83-ac44-9eaf9a2e813a" alt=""><figcaption></figcaption></figure>

## Setting Up Stream Scheduling

{% embed url="<https://superfluidhq.notion.site/Setting-Up-Stream-Scheduling-551888de690e402caee50e8d87cb6930>" %}
