Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
Lockup vs Flow docs
作成日
昨年
差分は期限切れになりません
クリア
エクスポート
共有
説明
45 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
177 行
すべてコピー
41 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
175 行
すべてコピー
---
---
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
コピー
コピー済み
コピー
コピー済み
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.
コピー
コピー済み
コピー
コピー済み
## 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
コピー
コピー済み
コピー
コピー済み
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
コピー
コピー済み
コピー
コピー済み
$ 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
```
```
コピー
コピー済み
コピー
コピー済み
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
コピー
コピー済み
コピー
コピー済み
## Install
Lockup
npm package
s
## Install
Flow
npm package
コピー
コピー済み
コピー
コピー済み
Let's install the
Lockup
Node.js packages using Bun:
Let's install the
Flow
Node.js packages using Bun:
```shell
```shell
コピー
コピー済み
コピー
コピー済み
$ bun add @sablier/
v2-core @sablier/v2-periphery
$ bun add @sablier/
flow
```
```
コピー
コピー済み
コピー
コピー済み
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
コピー
コピー済み
コピー
コピー済み
can find the
Lockup
contracts when you import them:
can find the
Flow
contracts when you import them:
```shell
```shell
コピー
コピー済み
コピー
コピー済み
$ 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
```
```
コピー
コピー済み
コピー
コピー済み
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
コピー
コピー済み
コピー
コピー済み
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`.
コピー
コピー済み
コピー
コピー済み
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)):
コピー
コピー済み
コピー
コピー済み
```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
コピー
コピー済み
コピー
コピー済み
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"
コピー
コピー済み
コピー
コピー済み
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
コピー
コピー済み
コピー
コピー済み
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
コピー
コピー済み
コピー
コピー済み
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
コピー
コピー済み
コピー
コピー済み
Foundry will enable you to create more sophisticated integrations with
Lockup
.
Foundry will enable you to create more sophisticated integrations with
Flow
.
保存された差分
原文
ファイルを開く
--- 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.
変更されたテキスト
ファイルを開く
--- 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.
違いを見つける