Skip to main content

Set Up Your Contract

The "Stream Management" series will guide you through how to withdraw, cancel, renounce, and transfer ownership of streams.

Before diving in, please note the following:

  1. We assume you are already familiar with creating streams.
  2. We also assume that the stream management contract is authorized to invoke each respective function. To learn more about access control in Lockup, see the Access Control guide.

With that said, let's begin. First, declare the Solidity version used to compile the contract:

// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22;

Import the relevant symbols from @sablier/core:

import { ISablierLockup } from "@sablier/lockup/src/interfaces/ISablierLockup.sol";

Create a contract called StreamManagement and declare an immutable variable sablier of type ISablierLockup:

contract StreamManagement {
ISablierLockup public immutable sablier;
}

Just like in the create stream guides, the next step requires you to head over to the Deployment Addresses page and copy the address of the Lockup contract. Then, you can deploy the stream management contract:

constructor(ISablierLockup sablier_) {
sablier = sablier_;
}

You're all set! You can now move on to the next page, which will teach you how to withdraw from a stream.