Diff
checker
Text
Text
Bilder
Dokumente
Excel
Ordner
Legal
Enterprise
Desktop-App
Preise
Einloggen
Diffchecker Desktop herunterladen
Texte vergleichen
Finde den Unterschied zwischen zwei Textdateien
Werkzeuge
Verlauf
Live-Editor
Gleiches ausblenden
Zeilenumbruch aus
Ansicht
Zweispaltig
Einspaltig
Vergleichsgenauigkeit
Intelligent
Wort
Zeichen
Syntaxhervorhebung
Syntax auswählen
Ignorieren
Text umwandeln
Zur ersten Änderung
Eingabe bearbeiten
Diffchecker Desktop
Der sicherste Weg, Diffchecker zu nutzen. Hol dir die Desktop-App: Deine Diffs verlassen nie deinen Computer!
Desktop holen
Lockup vs Flow docs
Erstellt
letztes Jahr
Diff läuft nie ab
Löschen
Exportieren
Teilen
Erklären
45 Entfernungen
Zeilen
Gesamt
Entfernt
Zeichen
Gesamt
Entfernt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
177 Zeilen
Kopieren
41 Hinzufügungen
Zeilen
Gesamt
Hinzugefügt
Zeichen
Gesamt
Hinzugefügt
Um diese Funktion weiterhin zu nutzen, aktualisiere auf
Diff
checker
Pro
Preise anzeigen
175 Zeilen
Kopieren
---
---
id: "local-environment"
id: "local-environment"
sidebar_position: 1
sidebar_position: 1
title: "Configure Your Local Environment"
title: "Configure Your Local Environment"
---
---
In this guide, we will go through the steps to set up a local development environment for building onchain integrations
In this guide, we will go through the steps to set up a local development environment for building onchain integrations
Kopieren
Kopiert
Kopieren
Kopiert
with
Lockup
. We will use Foundry to install
Lockup
as a dependency, and run a few simple tests.
with
Flow
. We will use Foundry to install
Flow
as a dependency, and run a few simple tests.
At the end, you’ll have a development environment set up that you can use to build the rest of the examples under
At the end, you’ll have a development environment set up that you can use to build the rest of the examples under
"Guides", or start your own integration project.
"Guides", or start your own integration project.
## Pre-requisites
## Pre-requisites
You will need the following software on your machine:
You will need the following software on your machine:
- [Git](https://git-scm.com/downloads)
- [Git](https://git-scm.com/downloads)
- [Foundry](https://github.com/foundry-rs/foundry)
- [Foundry](https://github.com/foundry-rs/foundry)
- [Node.js](https://nodejs.org/en/download)
- [Node.js](https://nodejs.org/en/download)
- [Bun](https://bun.sh)
- [Bun](https://bun.sh)
In addition, familiarity with [Ethereum](https://ethereum.org/) and [Solidity](https://soliditylang.org/) is requisite.
In addition, familiarity with [Ethereum](https://ethereum.org/) and [Solidity](https://soliditylang.org/) is requisite.
Kopieren
Kopiert
Kopieren
Kopiert
## Set up using
Lockup
integration template
## Set up using
Flow
integration template
We put together a template repository that you can use to get started quickly. This repository features a basic project
We put together a template repository that you can use to get started quickly. This repository features a basic project
Kopieren
Kopiert
Kopieren
Kopiert
structure, pre-configured
Lockup
imports, and a selection of sample contracts and tests.
structure, pre-configured
Flow
imports, and a selection of sample contracts and tests.
:::tip
:::tip
Make sure you are using the latest version of Foundry by running `foundryup`.
Make sure you are using the latest version of Foundry by running `foundryup`.
:::
:::
To install the template, simply execute the following commands:
To install the template, simply execute the following commands:
```shell
```shell
Kopieren
Kopiert
Kopieren
Kopiert
$ mkdir
lockup
-integration-template
$ mkdir
flow
-integration-template
$ cd
lockup
-integration-template
$ cd
flow
-integration-template
$ forge init --template sablier-labs/
lockup
-integration-template
$ forge init --template sablier-labs/
flow
-integration-template
$ bun install
$ bun install
```
```
Kopieren
Kopiert
Kopieren
Kopiert
Then, hop to the [Run a Fork Test](/guides/
lockup
/examples/local-environment#run-a-fork-test) section to complete your
Then, hop to the [Run a Fork Test](/guides/
flow
/examples/local-environment#run-a-fork-test) section to complete your
set
set
up and start developing.
up and start developing.
## Set up using Foundry template
## Set up using Foundry template
Foundry is a popular development toolkit for Ethereum projects, which we have used to build the Sablier Protocols. For
Foundry is a popular development toolkit for Ethereum projects, which we have used to build the Sablier Protocols. For
the purposes of this guide, Foundry will provide us with the tooling needed to compile and test our contracts.
the purposes of this guide, Foundry will provide us with the tooling needed to compile and test our contracts.
Let's use this command to spin up a new Foundry project:
Let's use this command to spin up a new Foundry project:
```shell
```shell
$ forge init my-project
$ forge init my-project
$ cd my-project
$ cd my-project
```
```
:::note
:::note
You might notice that the CLI is `forge` rather than `foundry`. This is because Foundry is a toolkit, and `forge` is
You might notice that the CLI is `forge` rather than `foundry`. This is because Foundry is a toolkit, and `forge` is
just one of the tools that comes with it.
just one of the tools that comes with it.
:::
:::
Once the initialization completes, take a look around at what got set up:
Once the initialization completes, take a look around at what got set up:
```tree
```tree
├── foundry.toml
├── foundry.toml
├── script
├── script
├── src
├── src
└── test
└── test
```
```
The folder structure should be intuitive:
The folder structure should be intuitive:
- `src` is where you'll write Solidity contracts
- `src` is where you'll write Solidity contracts
- `test` is where you'll write tests (also in Solidity)
- `test` is where you'll write tests (also in Solidity)
- `script` is where you'll write scripts to perform actions like deploying contracts (you guessed it, in Solidity)
- `script` is where you'll write scripts to perform actions like deploying contracts (you guessed it, in Solidity)
- `foundry.toml` is where you can configure your Foundry settings, which we will leave as is in this guide
- `foundry.toml` is where you can configure your Foundry settings, which we will leave as is in this guide
Kopieren
Kopiert
Kopieren
Kopiert
## Install
Lockup
npm package
s
## Install
Flow
npm package
Kopieren
Kopiert
Kopieren
Kopiert
Let's install the
Lockup
Node.js packages using Bun:
Let's install the
Flow
Node.js packages using Bun:
```shell
```shell
Kopieren
Kopiert
Kopieren
Kopiert
$ bun add @sablier/
v2-core @sablier/v2-periphery
$ bun add @sablier/
flow
```
```
Kopieren
Kopiert
Kopieren
Kopiert
Bun will download the
Lockup
contracts, along with their dependencies, and put them in the `node_modules` directory.
Bun will download the
Flow
contracts, along with their dependencies, and put them in the `node_modules` directory.
Let's remap the package names to point to the installed contracts. This step is required so that the Solidity compiler
Let's remap the package names to point to the installed contracts. This step is required so that the Solidity compiler
Kopieren
Kopiert
Kopieren
Kopiert
can find the
Lockup
contracts when you import them:
can find the
Flow
contracts when you import them:
```shell
```shell
Kopieren
Kopiert
Kopieren
Kopiert
$ echo "@sablier/
v2-core
=node_modules/@sablier/
v2-core/" >> remappings.txt
$ echo "@sablier/
flow
=node_modules/@sablier/
flow
/" >> remappings.txt
$ echo "@sablier/v2-periphery=node_modules/@sablier/v2-periphery
/" >> remappings.txt
$ echo "@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/" >> remappings.txt
$ echo "@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/" >> remappings.txt
$ echo "@prb/math/=node_modules/@prb/math/" >> remappings.txt
$ echo "@prb/math/=node_modules/@prb/math/" >> remappings.txt
```
```
Kopieren
Kopiert
Kopieren
Kopiert
That's it! You should now have a functional development environment to start building onchain
Lockup
integrations. Let's
That's it! You should now have a functional development environment to start building onchain
Flow
integrations. Let's
run a quick test to confirm everything is set up properly.
run a quick test to confirm everything is set up properly.
## Write your first contract
## Write your first contract
Kopieren
Kopiert
Kopieren
Kopiert
Delete the `src/Counter.sol` and `test/Counter.t.sol` files generated by Forge, and create
two
new file
s
:
Delete the `src/Counter.sol` and `test/Counter.t.sol` files generated by Forge, and create
a
new file
:
`src/
StreamCreator.
sol` and `test/StreamCreator.t.
sol`.
`src/
Flow
StreamCreator.
sol`.
Kopieren
Kopiert
Kopieren
Kopiert
Paste the following code into `src/
StreamCreator.sol`
(a detailed explanation of this contract can be found
Paste the following code into `src/
Flow
StreamCreator.sol`
.
[here](/guides/lockup/examples/create-stream/lockup-linear)):
Kopieren
Kopiert
Kopieren
Kopiert
```solidity reference title="
Lockup Linear
Stream Creator"
```solidity reference title="
Flow
Stream Creator"
https://github.com/sablier-labs/
examples
/blob/main/
lockup/core/LockupLinear
StreamCreator.sol
https://github.com/sablier-labs/
flow-integration-template
/blob/main/
src/Flow
StreamCreator.sol
```
```
Let's use Forge to compile this contract:
Let's use Forge to compile this contract:
```shell
```shell
$ forge build
$ forge build
```
```
If the contract was compiled correctly, you should see this message:
If the contract was compiled correctly, you should see this message:
```text
```text
[⠢] Compiling...
[⠢] Compiling...
[⠰] Compiling { number } files with { compiler }
[⠰] Compiling { number } files with { compiler }
[⠒] Solc { compiler } finished in { time }
[⠒] Solc { compiler } finished in { time }
Compiler run successful
Compiler run successful
```
```
:::info
:::info
Kopieren
Kopiert
Kopieren
Kopiert
The minimum Solidity version supported by the
Lockup
contracts is v0.8.
13
.
The minimum Solidity version supported by the
Flow
contracts is v0.8.
22
.
:::
:::
## Run a fork test
## Run a fork test
Foundry offers native support for running tests against a fork of Ethereum Mainnet, testnets and L2s, which is useful
Foundry offers native support for running tests against a fork of Ethereum Mainnet, testnets and L2s, which is useful
when building and testing integrations with onchain protocols like Sablier. In practice, this enables you to access all
when building and testing integrations with onchain protocols like Sablier. In practice, this enables you to access all
Sablier contracts deployed on Ethereum, and use them for testing your integration.
Sablier contracts deployed on Ethereum, and use them for testing your integration.
As a prerequisite, you will need an RPC that supports forking. A good solution for this is
As a prerequisite, you will need an RPC that supports forking. A good solution for this is
[Alchemy](https://alchemy.com/), as it includes forking in its free tier plan.
[Alchemy](https://alchemy.com/), as it includes forking in its free tier plan.
Once you have obtained your RPC, you can proceed to run the following test:
Once you have obtained your RPC, you can proceed to run the following test:
```solidity reference title="Stream Creator Test"
```solidity reference title="Stream Creator Test"
Kopieren
Kopiert
Kopieren
Kopiert
https://github.com/sablier-labs/
examples
/blob/main/
lockup/core/Lockup
StreamCreator.t.sol
https://github.com/sablier-labs/
flow-integration-template
/blob/main/
test/Flow
StreamCreator.t.sol
```
```
You can run the test using Forge:
You can run the test using Forge:
```shell
```shell
$ forge test
$ forge test
```
```
If the test passed, you should see a message like this:
If the test passed, you should see a message like this:
```text
```text
Kopieren
Kopiert
Kopieren
Kopiert
Ran 2 tests for
lockup/core/Lockup
StreamCreator.t.sol:
Lockup
StreamCreatorTest
Ran 2 tests for
test/Flow
StreamCreator.t.sol:
Flow
StreamCreatorTest
[PASS] test_
LockupDynamicStreamCreator
() (gas:
273719
)
[PASS] test_
CreateFlowStream
() (gas:
147915
)
[PASS] test_
LockupLinearStreamCreator
() (gas:
186388
)
[PASS] test_
CreateFlowStreamAndDeposit
() (gas:
224823
)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in
6.34s (5.80s
CPU time)
Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in
986.20ms (4.16ms
CPU time)
```
```
## Next steps
## Next steps
Congratulations! Your environment is now configured, and you are prepared to start building. Explore the guides section
Congratulations! Your environment is now configured, and you are prepared to start building. Explore the guides section
Kopieren
Kopiert
Kopieren
Kopiert
to discover various
Lockup
features available for integration. Remember to include all contracts (`.sol` files) in
the
to discover various
Flow
features available for integration. Remember to include all contracts (`.sol` files) in
`src` folder and their corresponding tests in the `test` folder.
the
`src` folder and their corresponding tests in the `test` folder.
As far as Foundry is concerned, there is much more to uncover. If you want to learn more about it, check out the
As far as Foundry is concerned, there is much more to uncover. If you want to learn more about it, check out the
[Foundry Book](https://book.getfoundry.sh/), which contains numerous examples and tutorials. A deep understanding of
[Foundry Book](https://book.getfoundry.sh/), which contains numerous examples and tutorials. A deep understanding of
Kopieren
Kopiert
Kopieren
Kopiert
Foundry will enable you to create more sophisticated integrations with
Lockup
.
Foundry will enable you to create more sophisticated integrations with
Flow
.
Gespeicherte Diffs
Originaltext
Datei öffnen
--- id: "local-environment" sidebar_position: 1 title: "Configure Your Local Environment" --- In this guide, we will go through the steps to set up a local development environment for building onchain integrations with Lockup. We will use Foundry to install Lockup as a dependency, and run a few simple tests. At the end, you’ll have a development environment set up that you can use to build the rest of the examples under "Guides", or start your own integration project. ## Pre-requisites You will need the following software on your machine: - [Git](https://git-scm.com/downloads) - [Foundry](https://github.com/foundry-rs/foundry) - [Node.js](https://nodejs.org/en/download) - [Bun](https://bun.sh) In addition, familiarity with [Ethereum](https://ethereum.org/) and [Solidity](https://soliditylang.org/) is requisite. ## Set up using Lockup integration template We put together a template repository that you can use to get started quickly. This repository features a basic project structure, pre-configured Lockup imports, and a selection of sample contracts and tests. :::tip Make sure you are using the latest version of Foundry by running `foundryup`. ::: To install the template, simply execute the following commands: ```shell $ mkdir lockup-integration-template $ cd lockup-integration-template $ forge init --template sablier-labs/lockup-integration-template $ bun install ``` Then, hop to the [Run a Fork Test](/guides/lockup/examples/local-environment#run-a-fork-test) section to complete your set up and start developing. ## Set up using Foundry template Foundry is a popular development toolkit for Ethereum projects, which we have used to build the Sablier Protocols. For the purposes of this guide, Foundry will provide us with the tooling needed to compile and test our contracts. Let's use this command to spin up a new Foundry project: ```shell $ forge init my-project $ cd my-project ``` :::note You might notice that the CLI is `forge` rather than `foundry`. This is because Foundry is a toolkit, and `forge` is just one of the tools that comes with it. ::: Once the initialization completes, take a look around at what got set up: ```tree ├── foundry.toml ├── script ├── src └── test ``` The folder structure should be intuitive: - `src` is where you'll write Solidity contracts - `test` is where you'll write tests (also in Solidity) - `script` is where you'll write scripts to perform actions like deploying contracts (you guessed it, in Solidity) - `foundry.toml` is where you can configure your Foundry settings, which we will leave as is in this guide ## Install Lockup npm packages Let's install the Lockup Node.js packages using Bun: ```shell $ bun add @sablier/v2-core @sablier/v2-periphery ``` Bun will download the Lockup contracts, along with their dependencies, and put them in the `node_modules` directory. Let's remap the package names to point to the installed contracts. This step is required so that the Solidity compiler can find the Lockup contracts when you import them: ```shell $ echo "@sablier/v2-core=node_modules/@sablier/v2-core/" >> remappings.txt $ echo "@sablier/v2-periphery=node_modules/@sablier/v2-periphery/" >> remappings.txt $ echo "@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/" >> remappings.txt $ echo "@prb/math/=node_modules/@prb/math/" >> remappings.txt ``` That's it! You should now have a functional development environment to start building onchain Lockup integrations. Let's run a quick test to confirm everything is set up properly. ## Write your first contract Delete the `src/Counter.sol` and `test/Counter.t.sol` files generated by Forge, and create two new files: `src/StreamCreator.sol` and `test/StreamCreator.t.sol`. Paste the following code into `src/StreamCreator.sol` (a detailed explanation of this contract can be found [here](/guides/lockup/examples/create-stream/lockup-linear)): ```solidity reference title="Lockup Linear Stream Creator" https://github.com/sablier-labs/examples/blob/main/lockup/core/LockupLinearStreamCreator.sol ``` Let's use Forge to compile this contract: ```shell $ forge build ``` If the contract was compiled correctly, you should see this message: ```text [⠢] Compiling... [⠰] Compiling { number } files with { compiler } [⠒] Solc { compiler } finished in { time } Compiler run successful ``` :::info The minimum Solidity version supported by the Lockup contracts is v0.8.13. ::: ## Run a fork test Foundry offers native support for running tests against a fork of Ethereum Mainnet, testnets and L2s, which is useful when building and testing integrations with onchain protocols like Sablier. In practice, this enables you to access all Sablier contracts deployed on Ethereum, and use them for testing your integration. As a prerequisite, you will need an RPC that supports forking. A good solution for this is [Alchemy](https://alchemy.com/), as it includes forking in its free tier plan. Once you have obtained your RPC, you can proceed to run the following test: ```solidity reference title="Stream Creator Test" https://github.com/sablier-labs/examples/blob/main/lockup/core/LockupStreamCreator.t.sol ``` You can run the test using Forge: ```shell $ forge test ``` If the test passed, you should see a message like this: ```text Ran 2 tests for lockup/core/LockupStreamCreator.t.sol:LockupStreamCreatorTest [PASS] test_LockupDynamicStreamCreator() (gas: 273719) [PASS] test_LockupLinearStreamCreator() (gas: 186388) Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 6.34s (5.80s CPU time) ``` ## Next steps Congratulations! Your environment is now configured, and you are prepared to start building. Explore the guides section to discover various Lockup features available for integration. Remember to include all contracts (`.sol` files) in the `src` folder and their corresponding tests in the `test` folder. As far as Foundry is concerned, there is much more to uncover. If you want to learn more about it, check out the [Foundry Book](https://book.getfoundry.sh/), which contains numerous examples and tutorials. A deep understanding of Foundry will enable you to create more sophisticated integrations with Lockup.
Bearbeitung
Datei öffnen
--- id: "local-environment" sidebar_position: 1 title: "Configure Your Local Environment" --- In this guide, we will go through the steps to set up a local development environment for building onchain integrations with Flow. We will use Foundry to install Flow as a dependency, and run a few simple tests. At the end, you’ll have a development environment set up that you can use to build the rest of the examples under "Guides", or start your own integration project. ## Pre-requisites You will need the following software on your machine: - [Git](https://git-scm.com/downloads) - [Foundry](https://github.com/foundry-rs/foundry) - [Node.js](https://nodejs.org/en/download) - [Bun](https://bun.sh) In addition, familiarity with [Ethereum](https://ethereum.org/) and [Solidity](https://soliditylang.org/) is requisite. ## Set up using Flow integration template We put together a template repository that you can use to get started quickly. This repository features a basic project structure, pre-configured Flow imports, and a selection of sample contracts and tests. :::tip Make sure you are using the latest version of Foundry by running `foundryup`. ::: To install the template, simply execute the following commands: ```shell $ mkdir flow-integration-template $ cd flow-integration-template $ forge init --template sablier-labs/flow-integration-template $ bun install ``` Then, hop to the [Run a Fork Test](/guides/flow/examples/local-environment#run-a-fork-test) section to complete your set up and start developing. ## Set up using Foundry template Foundry is a popular development toolkit for Ethereum projects, which we have used to build the Sablier Protocols. For the purposes of this guide, Foundry will provide us with the tooling needed to compile and test our contracts. Let's use this command to spin up a new Foundry project: ```shell $ forge init my-project $ cd my-project ``` :::note You might notice that the CLI is `forge` rather than `foundry`. This is because Foundry is a toolkit, and `forge` is just one of the tools that comes with it. ::: Once the initialization completes, take a look around at what got set up: ```tree ├── foundry.toml ├── script ├── src └── test ``` The folder structure should be intuitive: - `src` is where you'll write Solidity contracts - `test` is where you'll write tests (also in Solidity) - `script` is where you'll write scripts to perform actions like deploying contracts (you guessed it, in Solidity) - `foundry.toml` is where you can configure your Foundry settings, which we will leave as is in this guide ## Install Flow npm package Let's install the Flow Node.js packages using Bun: ```shell $ bun add @sablier/flow ``` Bun will download the Flow contracts, along with their dependencies, and put them in the `node_modules` directory. Let's remap the package names to point to the installed contracts. This step is required so that the Solidity compiler can find the Flow contracts when you import them: ```shell $ echo "@sablier/flow=node_modules/@sablier/flow/" >> remappings.txt $ echo "@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/" >> remappings.txt $ echo "@prb/math/=node_modules/@prb/math/" >> remappings.txt ``` That's it! You should now have a functional development environment to start building onchain Flow integrations. Let's run a quick test to confirm everything is set up properly. ## Write your first contract Delete the `src/Counter.sol` and `test/Counter.t.sol` files generated by Forge, and create a new file: `src/FlowStreamCreator.sol`. Paste the following code into `src/FlowStreamCreator.sol`. ```solidity reference title="Flow Stream Creator" https://github.com/sablier-labs/flow-integration-template/blob/main/src/FlowStreamCreator.sol ``` Let's use Forge to compile this contract: ```shell $ forge build ``` If the contract was compiled correctly, you should see this message: ```text [⠢] Compiling... [⠰] Compiling { number } files with { compiler } [⠒] Solc { compiler } finished in { time } Compiler run successful ``` :::info The minimum Solidity version supported by the Flow contracts is v0.8.22. ::: ## Run a fork test Foundry offers native support for running tests against a fork of Ethereum Mainnet, testnets and L2s, which is useful when building and testing integrations with onchain protocols like Sablier. In practice, this enables you to access all Sablier contracts deployed on Ethereum, and use them for testing your integration. As a prerequisite, you will need an RPC that supports forking. A good solution for this is [Alchemy](https://alchemy.com/), as it includes forking in its free tier plan. Once you have obtained your RPC, you can proceed to run the following test: ```solidity reference title="Stream Creator Test" https://github.com/sablier-labs/flow-integration-template/blob/main/test/FlowStreamCreator.t.sol ``` You can run the test using Forge: ```shell $ forge test ``` If the test passed, you should see a message like this: ```text Ran 2 tests for test/FlowStreamCreator.t.sol:FlowStreamCreatorTest [PASS] test_CreateFlowStream() (gas: 147915) [PASS] test_CreateFlowStreamAndDeposit() (gas: 224823) Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 986.20ms (4.16ms CPU time) ``` ## Next steps Congratulations! Your environment is now configured, and you are prepared to start building. Explore the guides section to discover various Flow features available for integration. Remember to include all contracts (`.sol` files) in the`src` folder and their corresponding tests in the `test` folder. As far as Foundry is concerned, there is much more to uncover. If you want to learn more about it, check out the [Foundry Book](https://book.getfoundry.sh/), which contains numerous examples and tutorials. A deep understanding of Foundry will enable you to create more sophisticated integrations with Flow.
Unterschied finden