• Stars
    star
    290
  • Rank 142,981 (Top 3 %)
  • Language
    Solidity
  • License
    Other
  • Created over 2 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

⏳ Core smart contracts of the Sablier V2 token distribution protocol

Sablier V2 Core Github Actions Coverage Foundry Discord

This repository contains the core smart contracts of the Sablier V2 Protocol. For higher-level logic, see the sablier-labs/v2-periphery repository.

In-depth documentation is available at docs.sablier.com.

Background

Sablier is a smart contract protocol that enables trustless streaming of ERC-20 assets. In this context, streaming means the ability to make payments by the second.

The protocol features two streaming models called Lockup Linear and Lockup Dynamic, in which the sender locks up a specified amount of ERC-20 assets in a contract. The contract progressively allocates the funds to the designated recipient, who can access them as they become available over time. The streaming rate is influenced by various factors, including the start and end times, as well as the total amount of assets locked up.

Install

Foundry

First, run the install step:

forge install sablier-labs/v2-core

Your .gitmodules file should now contain the following entry:

[submodule "lib/v2-core"]
  branch = "release"
  path = "lib/v2-core"
  url = "https://github.com/sablier-labs/v2-core"

Finally, add this to your remappings.txt file:

@sablier/v2-core/=lib/v2-core/

Node.js

Sablier V2 Core is available as a Node.js package:

pnpm add @sablier/v2-core

Usage

This is just a glimpse of Sablier V2 Core. For more guides and examples, see the documentation.

import { ISablierV2LockupLinear } from "@sablier/v2-core/src/interfaces/ISablierV2LockupLinear.sol";

contract MyContract {
  ISablierV2LockupLinear sablier;

  function buildSomethingWithSablier() external {
    // ...
  }
}

Architecture

V2 Core uses a singleton-style architecture, where all streams are managed in the LockupLinear and LockupDynamic contracts. That is, Sablier does not deploy a new contract for each stream. It bundles all streams into a single contract, which is more gas-efficient and easier to maintain.

For more information, see the Technical Overview in our docs, as well as these diagrams.

Deployments

The list of all deployment addresses can be found here. For guidance on the deploy scripts, see the Deployments wiki.

It is worth noting that not every file in this repository is included in the current deployments. For instance, the SablierV2FlashLoan abstract is not inherited by any contract on the main branch, but we have kept it in version control because we may decide to use it in the future.

Security

The codebase has undergone rigorous audits by leading security experts from Cantina, as well as independent auditors. For a comprehensive list of all audits conducted, please click here.

For any security-related concerns, please refer to the SECURITY policy. This repository is subject to a bug bounty program per the terms outlined in the aforementioned policy.

Contributing

Feel free to dive in! Open an issue, start a discussion or submit a PR. For any informal concerns or feedback, please join our Discord server.

For guidance on how to create PRs, see the CONTRIBUTING guide.

License

The primary license for Sablier V2 Core is the Business Source License 1.1 (BUSL-1.1), see LICENSE.md. However, there are exceptions:

  • All files in src/interfaces/ and src/types are licensed under GPL-3.0-or-later, see LICENSE-GPL.md.
  • Several files in src, script, and test are licensed under GPL-3.0-or-later, see LICENSE-GPL.md.
  • Many files in test/ remain unlicensed (as indicated in their SPDX headers).

More Repositories

1

v1-protocol

Core smart contracts of the Sablier V1 protocol
JavaScript
263
star
2

v1-subgraph

Subgraph for the Sablier cryptoasset streaming protocol
TypeScript
28
star
3

v2-periphery

🎛 Peripheral smart contracts for interacting with Sablier V2
Solidity
19
star
4

v1-safe-app

Safe App for interacting with the Sablier protocol
TypeScript
19
star
5

v1-smooth-contracts

Bare-bones implementation of the Sablier protocol
Solidity
15
star
6

examples

Example integrations with Sablier
Solidity
14
star
7

docs

Documentation and guides for Sablier
TypeScript
11
star
8

audits

Smart contract audits performed on Sablier by third-party security researchers
10
star
9

v2-sandbox

Front-end sandbox development environments for Sablier V2
9
star
10

v1-abis

The ABIs (Application Binary Interfaces) for the Sablier money streaming protocol
9
star
11

sablier-v2-integration-template

Sablier V2 integration template
Solidity
7
star
12

community-token-list

JavaScript
7
star
13

erc1620

Mirror of the erc-1620 standard from ethereum/eips
5
star
14

branding

Sablier brand guidelines and assets
5
star
15

sablier-v2-steakhut

Custom script for batch creating the $STEAK streams
Solidity
4
star
16

legacy-uis

A mirror of the legacy Sablier front-ends
JavaScript
4
star
17

merkle-api

Rust
4
star
18

v2-subgraphs

Subgraphs for Sablier V2 token streaming protocol
TypeScript
4
star
19

assets

Media assets used in Sablier
3
star
20

v1-docs

Documentation website for Sablier V1
JavaScript
3
star
21

sablier-labs.github.io

File hosting
HTML
3
star
22

reusable-workflows

Reusable workflows to use in GitHub Actions
2
star
23

v1-stats

TypeScripts utilities to calculate stats related to the Sablier protocol
TypeScript
2
star
24

v2-deployments

Keeping track of Sablier V2 deployments
2
star
25

sablier-v2-exactly-protocol

Custom script for creating polynomial $EXA streams
Solidity
2
star
26

v2-sandbox-react

React Sandbox for interacting with the Sablier V2 protocol
TypeScript
1
star