|
28 | 28 |
|
29 | 29 | ## Usage |
30 | 30 |
|
31 | | -If you're building a dapp using existing protocol or Super Token contracts, then you should use [`@superfluid-finance/sdk-core`](/packages/sdk-core). [Here](https://docs.superfluid.finance/superfluid/networks/networks) you can find a list of networks where the Superfluid protocol is already deployed. |
32 | | - |
33 | | -If you're building a smart contract that uses Superfluid protocol, or even your own [SuperApp](https://docs.superfluid.finance/), then great! This is definitely the place to be. |
| 31 | +[Here](https://explorer.superfluid.org/protocol) you can find a list of networks where the Superfluid protocol is already deployed. |
34 | 32 |
|
35 | 33 | ### Installation |
36 | 34 |
|
37 | | -Prerequisites: |
38 | | -- [node.js v18+](https://nodejs.org/en/download). The project recommends 22, and is tested with node 18,20,22. |
39 | | -- [yarn](https://classic.yarnpkg.com/en/docs/install) |
| 35 | +Once you have set up your project, cd into its base directory and add the npm package: |
| 36 | + |
| 37 | +##### foundry |
| 38 | + |
| 39 | +**Prerequisites:** |
40 | 40 | - [forge](https://book.getfoundry.sh/getting-started/installation) |
41 | 41 |
|
42 | | -Once you have set up your project, cd into its base directory and add the npm package: |
| 42 | +**Install dependencies:** |
| 43 | +```sh |
| 44 | +forge install superfluid-protocol-monorepo=superfluid-finance/protocol-monorepo@dev --no-commit |
| 45 | +forge install openzeppelin-contracts-v4=https://github.com/OpenZeppelin/openzeppelin-contracts@release-v4.9 --no-commit |
| 46 | +``` |
43 | 47 |
|
44 | | -##### hardhat |
| 48 | +**Set up remappings:** |
45 | 49 | ```sh |
46 | | -$ yarn add @superfluid-finance/ethereum-contracts |
| 50 | +echo -e "@superfluid-finance/=lib/superfluid-protocol-monorepo/packages/\n@openzeppelin/contracts-v4/=lib/openzeppelin-contracts-v4/contracts/" >> remappings.txt |
47 | 51 | ``` |
48 | 52 |
|
49 | | -##### foundry |
| 53 | +If you want to use **openzeppelin v4** in your project's contracts, you should either: |
| 54 | +- use the custom import path `@openzeppelin/contracts-v4` in your contracts |
| 55 | +or |
| 56 | +- add a remapping for the default import path: `@openzeppelin/contracts/=lib/openzeppelin-contracts-v4/contracts/` |
| 57 | + |
| 58 | +If you want to use **openzeppelin v5** in your project's contracts, you can use it alongside the v4 needed by Superfluid. |
| 59 | + |
| 60 | +##### hardhat |
50 | 61 |
|
| 62 | +**Prerequisites:** |
| 63 | +- [node.js v18+](https://nodejs.org/en/download). The project recommends v22, and is tested with versions 18,20,22. |
| 64 | +- [yarn](https://classic.yarnpkg.com/en/docs/install) or any other node package manager of your choice. |
| 65 | + |
| 66 | +**Install dependencies:** |
51 | 67 | ```sh |
52 | | -$ forge install superfluid-protocol-monorepo=superfluid-finance/protocol-monorepo@dev |
53 | | -$ # or using ethereum-contracts@v1.6.0 |
54 | | -$ forge install superfluid-protocol-monorepo=superfluid-finance/protocol-monorepo@$(git ls-remote https://github.com/superfluid-finance/protocol-monorepo.git ethereum-contracts@v1.6.0 | awk '{print $1}') |
| 68 | +$ yarn add @superfluid-finance/ethereum-contracts |
55 | 69 | ``` |
56 | 70 |
|
| 71 | +If you want to use **openzeppelin v4** in your project's contracts, we recommend using the package installed as a nested dependency of this package, using the import path `@openzeppelin/contracts-v4/`. |
| 72 | + |
| 73 | +If you want to use **openzeppelin v5** in your project's contracts, you need to add the dependency yourself and can use it at the default import path `@openzeppelin/contracts/`. |
| 74 | + |
57 | 75 | ### Smart Contract |
58 | 76 |
|
59 | 77 | You can then import Superfluid interfaces or contracts into your contracts like this: |
60 | 78 |
|
61 | 79 | ```js |
62 | | -import { IConstantFlowAgreementV1 } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/agreements/IConstantFlowAgreementV1.sol"; |
| 80 | +import { IConstantFlowAgreementV1 } from "@superfluid-finance/ethereum-contracts/contracts/interfaces/superfluid/ISuperfluid.sol"; |
63 | 81 | ``` |
64 | | -The paths in the npm package are the same as in this repository. |
| 82 | +(Most interfaces belonging to the Superfluid protocol can be imported from `ISuperfluid.sol`) |
65 | 83 |
|
66 | 84 | ### Writing Tests |
67 | 85 |
|
|
0 commit comments