Diff
checker
Testo
Testo
Immagini
Documenti
Excel
Cartelle
Legal
Enterprise
Applicazione per desktop
Prezzi
Accedi
Scarica Diffchecker Desktop
Confronta il testo
Trova la differenza tra due file di testo
Strumenti
Cronologia
Editor live
Comprimi invariate
Senza a capo
Layout
Diviso
Unificato
Livello di dettaglio
Intelligente
Parola
Carattere
Evidenziazione sintassi
Scegli sintassi
Ignora
Trasforma testo
Vai alla prima modifica
Modifica input
Diffchecker Desktop
Il modo più sicuro per usare Diffchecker. Ottieni l'app Diffchecker Desktop: i tuoi diff non lasciano mai il tuo computer!
Ottieni Desktop
Lockup vs Flow docs
Creato
anno scorso
Il diff non scade mai
Eliminare
Esporta
Condividere
Spiegare
45 rimozioni
Linee
Totale
Rimosso
Caratteri
Totale
Rimosso
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
177 linee
Copia tutti
41 aggiunte
Linee
Totale
Aggiunto
Caratteri
Totale
Aggiunto
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
175 linee
Copia tutti
---
---
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
Copia
Copiato
Copia
Copiato
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.
Copia
Copiato
Copia
Copiato
## 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
Copia
Copiato
Copia
Copiato
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
Copia
Copiato
Copia
Copiato
$ 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
```
```
Copia
Copiato
Copia
Copiato
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
Copia
Copiato
Copia
Copiato
## Install
Lockup
npm package
s
## Install
Flow
npm package
Copia
Copiato
Copia
Copiato
Let's install the
Lockup
Node.js packages using Bun:
Let's install the
Flow
Node.js packages using Bun:
```shell
```shell
Copia
Copiato
Copia
Copiato
$ bun add @sablier/
v2-core @sablier/v2-periphery
$ bun add @sablier/
flow
```
```
Copia
Copiato
Copia
Copiato
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
Copia
Copiato
Copia
Copiato
can find the
Lockup
contracts when you import them:
can find the
Flow
contracts when you import them:
```shell
```shell
Copia
Copiato
Copia
Copiato
$ 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
```
```
Copia
Copiato
Copia
Copiato
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
Copia
Copiato
Copia
Copiato
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`.
Copia
Copiato
Copia
Copiato
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)):
Copia
Copiato
Copia
Copiato
```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
Copia
Copiato
Copia
Copiato
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"
Copia
Copiato
Copia
Copiato
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
Copia
Copiato
Copia
Copiato
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
Copia
Copiato
Copia
Copiato
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
Copia
Copiato
Copia
Copiato
Foundry will enable you to create more sophisticated integrations with
Lockup
.
Foundry will enable you to create more sophisticated integrations with
Flow
.
Diff salvati
Testo originale
Apri file
--- 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.
Testo modificato
Apri file
--- 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.
Trovare la differenza