Skip to content

Commit 5b89059

Browse files
committed
refactor: change export structure of releases
docs: draft README and CONTRIBUTING guide refactor: rename queries to sablier refactor: fewer default exports
1 parent b3d222e commit 5b89059

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+388
-304
lines changed

CONTRIBUTING.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Contributing
2+
3+
### Prerequisites
4+
5+
- [Node.js](https://nodejs.org) (v20+)
6+
- [Bun](https://bun.sh) (package manager)
7+
- [Just](https://github.com/casey/just) (task runner)
8+
9+
### Setup
10+
11+
```bash
12+
git clone https://github.com/sablier-labs/deployments.git
13+
cd deployments
14+
just install
15+
```
16+
17+
### Available Commands
18+
19+
```bash
20+
just --list # Show all available commands
21+
just build # Build the TypeScript package
22+
just full-check # Run all code quality checks
23+
just full-write # Auto-fix formatting and linting
24+
just test # Run test suite
25+
```
26+
27+
### Development Workflow
28+
29+
1. Fork the repository
30+
2. Create a feature branch
31+
3. Make your changes
32+
4. Run `just full-check` to verify code quality
33+
5. Submit a pull request
34+
35+
### Adding New Chains
36+
37+
TODO
38+
39+
### Adding New Deployments
40+
41+
TODO

README.md

Lines changed: 121 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,155 @@
1-
# Sablier Deployments
1+
# Sablier Deployments 🚀
22

3-
TODO: rewrite this
3+
Deployment data for the [Sablier Protocol](https://sablier.com), the token distribution protocol for Ethereum and
4+
EVM-compatible chains.
45

5-
This repository keeps track of Sablier deployment bundles, each of which includes:
6+
This package provides:
67

7-
1. Contract artifacts and ABIs.
8-
2. The [broadcast](https://book.getfoundry.sh/guides/scripting-with-solidity) directories generated by Foundry upon
9-
running the deploy scripts.
8+
- **Contract addresses** across all supported protocols and chains
9+
- **Release management** for multiple protocol versions
10+
- **Chain data** with RPC endpoints and explorer URLs
11+
- **TypeScript SDK** for accessing deployment data programmatically
1012

11-
The deployments are indexed by:
13+
## Installation 📦
1214

13-
1. Repository ("lockup" or "flow")
14-
2. Version name (e.g. "v1.0.0")
15-
3. Artifacts
16-
4. Broadcasts, which in turn are indexed by chain name.
15+
```bash
16+
npm install @sablier/deployments
17+
# or
18+
yarn add @sablier/deployments
19+
# or
20+
bun add @sablier/deployments
21+
```
1722

18-
If you need the deployment addresses, you can find them in the [docs](https://docs.sablier.com).
23+
## Protocol Overview 🎯
1924

20-
## Background
25+
Sablier supports multiple protocols across versions:
2126

22-
Sablier Protocols have been built, tested, formatted, and deployed with the [Foundry](https://getfoundry.sh) smart
23-
contract development toolchain.
27+
### Current Protocols
2428

25-
To learn more about Foundry, see the [Foundry Book](https://book.getfoundry.sh).
29+
- **💧 Sablier Airdrops** - Merkle-based airdrop distributions with an optional vesting module
30+
- **🔒 Sablier Lockup** - Time-locked token vesting with cliffs
31+
- **🔄 Sablier Flow** - Token streaming with continuous payments
32+
- **⚡ Sablier Legacy** - Old release similar to Lockup, deployed between 2019-2021
2633

27-
To learn more about Sablier, see the [Sablier Docs](https://docs.sablier.com).
34+
### Supported Chains
2835

29-
## Addresses
36+
**Mainnets**: Ethereum, Arbitrum, Optimism, Polygon, Base, BSC, Avalanche, and 20+ more.
3037

31-
To view the deployment addresses, use the links below.
38+
**Testnets**: Sepolia, Base Sepolia, Optimism Sepolia, and more.
3239

33-
- [Airdrops deployment addresses](https://docs.sablier.com/guides/airdrops/deployments)
34-
- [Lockup deployment addresses](https://docs.sablier.com/guides/lockup/deployments)
35-
- [Flow deployment addresses](https://docs.sablier.com/guides/flow/deployments)
40+
### Addresses
3641

37-
### Packages
42+
The addresses are provided in this package, but you can also view the deployment addresses on the
43+
[Sablier Docs](https://docs.sablier.com) website:
3844

39-
The contract artifacts and the ABIs are published as NPM packages:
45+
- [Sablier Airdrops addresses](https://docs.sablier.com/guides/airdrops/deployments)
46+
- [Sablier Lockup addresses](https://docs.sablier.com/guides/lockup/deployments)
47+
- [Sablier Flow addresses](https://docs.sablier.com/guides/flow/deployments)
4048

41-
- [@sablier/airdrops](https://npmjs.com/package/@sablier/airdrops)
42-
- [@sablier/lockup](https://npmjs.com/package/@sablier/lockup)
43-
- [@sablier/flow](https://npmjs.com/package/@sablier/flow)
49+
## API Reference 📖
4450

45-
Older versions of Lockup (before v2.0.0) and Airdrops (before v1.3.0) have been published through these packages:
51+
### Chains
4652

47-
- [@sablier/v2-core](https://npmjs.com/package/@sablier/v2-core)
48-
- [@sablier/v2-periphery](https://npmjs.com/package/@sablier/v2-periphery)
53+
Our chain types extend upon Viem's [Chain](https://viem.sh/docs/chains/introduction).
4954

50-
## Scripts
55+
```typescript
56+
import { chains } from "@sablier/deployments";
5157

52-
The contracts have been deployed using these scripts:
58+
// Get by name
59+
const ethereum = chains.ethereum;
5360

54-
- [airdrops/script](https://github.com/sablier-labs/airdrops/tree/main/script)
55-
- [lockup/script](https://github.com/sablier-labs/lockup/tree/main/script)
56-
- [flow/script](https://github.com/sablier-labs/flow/tree/main/script)
61+
// Get chain by ID
62+
const arbitrum = chains.queries.get({ chainId: 42161 });
5763

58-
Specifically, with the "DeployDeterministic" scripts, which rely upon this CREATE2 factory:
64+
// Get chain by slug
65+
const polygon = chains.queries.get({ slug: "polygon" });
5966

60-
- https://github.com/Arachnid/deterministic-deployment-proxy
67+
// Check if chain supports Sablier UI
68+
if (ethereum.isSupportedByUI) {
69+
console.log("Available on app.sablier.com");
70+
}
71+
```
6172

62-
### Differentiation
73+
### Contracts
6374

64-
The rationale for using CREATE2 is not to generate deterministic deployment addresses - quite the opposite. The goal is
65-
to have different addresses on each chain. By using CREATE2, we can systematically differentiate the contract addresses
66-
by passing a salt, whereas if we had used CREATE, the deployer's nonce would have impacted the resulting deployment
67-
address.
75+
```typescript
76+
import { releases, sablier } from "@sablier/deployments";
6877

69-
## Logging
78+
// Get contract by name and chain
79+
const lockup = sablier.contracts.get({
80+
name: "SablierLockup",
81+
release: releases.lockup["v2.0"],
82+
});
83+
```
7084

71-
This project uses Winston for logging. By default, logs are output to the console, but they can also be written to a
72-
file by setting the following environment variables:
85+
### Releases
7386

74-
- `LOG_FILE_PATH`: Path to the log file (e.g., `./logs/deployments.log`). When set, logs will be written to this file in
75-
addition to the console.
76-
- `LOG_LEVEL`: Set the logging level (default: `info`). Valid values are: `error`, `warn`, `info`, `verbose`, `debug`,
77-
and `silly`.
87+
```typescript
88+
import { releases, sablier } from "@sablier/deployments";
7889

79-
Example usage:
90+
// Get specific releases
91+
const airdropsV1_3 = releases.airdrops["v1.3"];
92+
const lockupV2_0 = releases.lockup["v2.0"];
93+
const flowV1_1 = releases.flow["v1.1"]";
8094

81-
```bash
82-
# Log to both console and file
83-
LOG_FILE_PATH=./logs/deployments.log bun run build
95+
// Get all Lockup releases
96+
const allLockups = sablier.releases.getAll({ protocol: "lockup" });
97+
```
98+
99+
## Data Structure 📊
100+
101+
### Release Object
102+
103+
See the [types](./src/types.ts) for more information.
84104

85-
# Set a custom log level
86-
LOG_LEVEL=debug LOG_FILE_PATH=./logs/debug.log bun run test
105+
```typescript
106+
interface Release {
107+
protocol: "flow" | "lockup" | "airdrops" | "legacy";
108+
version: "v1.0" | "v1.1" | "v2.0" | ...;
109+
isLatest: boolean;
110+
contractNames: string[];
111+
deployments: Deployment[];
112+
}
87113
```
88114

89-
## License
115+
### Deployment Broadcasts
116+
117+
The deployment broadcasts (generated with [Foundry](https://book.getfoundry.sh/reference/cheatcodes/broadcast/)) are
118+
located under the [`data`](./data) directory.
119+
120+
Each deployment is stored as JSON with a structure like this, which is generated by Foundry:
121+
122+
```json
123+
{
124+
"transactions": [...], // Deployment transactions
125+
"receipts": [...], // Transaction receipts
126+
"libraries": [...], // Linked libraries
127+
"returns": { // Deployed contract addresses
128+
"flow": "0x...",
129+
"nftDescriptor": "0x..."
130+
},
131+
"timestamp": 1738015038, // Deployment timestamp
132+
"chain": 1, // Chain ID
133+
"commit": "a0fa33d" // Git commit hash
134+
}
135+
```
136+
137+
## Contributing 🤝
138+
139+
We welcome contributions!
140+
141+
- 🐛 [Bug reports](https://github.com/sablier-labs/deployments/issues/new)
142+
- 💬 [Discussions](https://github.com/sablier-labs/deployments/discussions/new)
143+
- 💬 [Discord](https://discord.gg/bSwRCwWRsT)
144+
145+
For guidance on how to make PRs, see the [CONTRIBUTING](./CONTRIBUTING.md) guide.
146+
147+
## Links 📚
148+
149+
- 📖 [Protocol Docs](https://docs.sablier.com)
150+
- 🔗 [API Reference](https://docs.sablier.com/api/overview)
151+
-[Sablier App](https://app.sablier.com)
152+
153+
## License 📄
90154

91-
This repo is licensed under GPL 3-0 or later.
155+
This project is licensed under [GPL-3.0-or-later](./LICENSE.md).

TODOs.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
# Priority 1
22

3-
- [ ] Add instructions in the README
43
- [ ] Refactor `data` broadcasts to get rid of `mainnets` and `testnets` dichotomy
5-
6-
# Priority 2
7-
8-
- [ ] Add `@unimplemented` tag for `compilerSettings`

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@sablier/deployments",
33
"description": "Deployment data for the Sablier Protocol",
4-
"version": "1.0.0-alpha.45",
4+
"version": "1.0.0-alpha.46",
55
"author": {
66
"name": "Sablier Labs Ltd",
77
"url": "https://sablier.com"
@@ -30,6 +30,9 @@
3030
"vitest": "^3.1",
3131
"winston": "^3.17"
3232
},
33+
"engines": {
34+
"node": ">=20"
35+
},
3336
"files": [
3437
"dist"
3538
],

scripts/check-broadcast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from "node:path";
1+
import * as path from "node:path";
22
import type { Sablier } from "@src/types";
33
import * as fs from "fs-extra";
44
import { logInfo } from "./logger";

scripts/print-aliases.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { releases } from "@src/releases";
1+
import { sablier } from "@src/sablier";
22
import _ from "lodash";
3-
import logger, { logAndThrow } from "./logger";
3+
import logger from "./logger";
44

55
type AliasRow = {
66
alias: string;
@@ -11,7 +11,7 @@ type AliasRow = {
1111
async function main(): Promise<void> {
1212
const rows: AliasRow[] = [];
1313

14-
for (const release of releases) {
14+
for (const release of sablier.releases.getAll()) {
1515
const releaseName = `${release.protocol} ${release.version}`;
1616
if (!release.aliases) {
1717
logger.verbose(`Skipping ${releaseName} because it has no aliases`);
@@ -55,6 +55,4 @@ async function main(): Promise<void> {
5555
}
5656
}
5757

58-
main().catch((error) => {
59-
logAndThrow({ msg: `Error printing aliases: ${error.message}` });
60-
});
58+
main();

scripts/print-missing.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
* for all chains, only the ones listed in the releases.
55
*
66
* Usage:
7-
* bun run scripts/print-missing-broadcasts.ts airdrops
8-
* bun run scripts/print-missing-broadcasts.ts flow
9-
* bun run scripts/print-missing-broadcasts.ts lockup
7+
* bun run scripts/print-missing.ts airdrops
8+
* bun run scripts/print-missing.ts flow
9+
* bun run scripts/print-missing.ts lockup
1010
*/
11-
import queries from "@src/queries";
12-
import { releasesByProtocol } from "@src/releases";
11+
import { sablier } from "@src/sablier";
1312
import type { Sablier } from "@src/types";
1413
import _ from "lodash";
1514
import { checkBroadcast } from "./check-broadcast";
16-
import logger, { logAndThrow } from "./logger";
15+
import logger from "./logger";
1716

1817
const EMOJIS = {
1918
check: "✅",
@@ -35,9 +34,10 @@ async function main(): Promise<void> {
3534

3635
logger.info(`\n${EMOJIS.folder} Checking ${protocol} broadcasts...\n`);
3736

38-
for (const release of releasesByProtocol[protocol]) {
37+
const allReleases = sablier.releases.getAll({ protocol });
38+
for (const release of allReleases) {
3939
for (const deployment of release.deployments) {
40-
const chain = queries.chains.getOrThrow(deployment.chainId);
40+
const chain = sablier.chains.getOrThrow(deployment.chainId);
4141

4242
let hasValidBroadcasts = false;
4343

@@ -117,9 +117,7 @@ async function main(): Promise<void> {
117117
console.log(`${EMOJIS.testnet} Missing testnet broadcasts: ${testnetCount}\n`);
118118
}
119119

120-
main().catch((error) => {
121-
logAndThrow({ msg: `Error checking missing broadcasts: ${error.message}` });
122-
});
120+
main();
123121

124122
/* -------------------------------------------------------------------------- */
125123
/* HELPERS */

src/chains/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const config = {
2323
[viem.taiko.id]: true,
2424
} as ConfigBool,
2525
},
26-
// These chains have the artifacts under the `artifacts-zk` directory
26+
// These chains have the artifacts under the `artifacts-zk` directory.
2727
zk: {
2828
[viem.abstract.id]: true,
2929
[viem.sophon.id]: true,

src/chains/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@
99
* @see https://chainlist.org
1010
*/
1111
export * from "./data";
12-
export { default as queries } from "./queries";

src/chains/queries.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import type { Sablier } from "@src/types";
22
import _ from "lodash";
33
import { chains as allChains } from "./data";
44

5-
const queries = {
5+
export const chainsQueries = {
66
get: (chainId: number): Sablier.Chain | undefined => {
77
return _.find(allChains, { id: chainId });
88
},
99
getAll: (): Sablier.Chain[] => {
1010
return _.values(allChains);
1111
},
12-
getName: (chainId: number): string | undefined => {
13-
return _.find(allChains, { id: chainId })?.name;
12+
getBySlug: (slug: string): Sablier.Chain | undefined => {
13+
return _.find(allChains, { slug });
1414
},
1515
getOrThrow: (chainId: number): Sablier.Chain => {
1616
const chain = _.find(allChains, { id: chainId });
@@ -20,5 +20,3 @@ const queries = {
2020
return chain;
2121
},
2222
};
23-
24-
export default queries;

0 commit comments

Comments
 (0)