Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: upgrade to latest V2 Core and V2 Periphery #2

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
Expand Down Expand Up @@ -50,8 +48,6 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
Expand Down Expand Up @@ -84,8 +80,6 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

3 changes: 1 addition & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
bytecode_hash = "none"
emv_version = "paris"
fuzz = { runs = 1_000 }
libs = ["lib"]
optimizer = true
optimizer_runs = 10_000
out = "out"
solc = "0.8.19"
solc = "0.8.21"
src = "src"
test = "test"

Expand Down
1 change: 0 additions & 1 deletion lib/forge-std
Submodule forge-std deleted from e8a047
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
"url": "https://github.com/sablier-labs/sablier-integration-template/issues"
},
"devDependencies": {
"@prb/test": "0.6.5",
"forge-std": "github:foundry-rs/forge-std#v1.5.6",
"prettier": "^3.0.0",
"solhint": "^3.4.1"
},
"dependencies": {
"@openzeppelin/contracts": "4.9.2",
"@prb/math": "4.0.1",
"@sablier/v2-core": "1.0.2",
"@sablier/v2-periphery": "1.0.3"
"@prb/math": "4.0.2",
"@sablier/v2-core": "1.1.1",
"@sablier/v2-periphery": "1.1.0"
},
"homepage": "https://github.com/sablier-labs/sablier-integration-template#readme",
"keywords": [
Expand Down
60 changes: 31 additions & 29 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
@prb/math/=node_modules/@prb/math/
@sablier/v2-core=node_modules/@sablier/v2-core/
@sablier/v2-periphery=node_modules/@sablier/v2-periphery/
forge-std=lib/forge-std/src
@prb/test/=node_modules/@prb/test/
@sablier/v2-core/=node_modules/@sablier/v2-core/
@sablier/v2-periphery/=node_modules/@sablier/v2-periphery/
forge-std/=node_modules/forge-std/
5 changes: 3 additions & 2 deletions src/StreamCreator.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.19;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { ud60x18 } from "@prb/math/src/UD60x18.sol";
import { ISablierV2LockupLinear } from "@sablier/v2-core/src/interfaces/ISablierV2LockupLinear.sol";
import { Broker, LockupLinear } from "@sablier/v2-core/src/types/DataTypes.sol";
import { ud60x18 } from "@sablier/v2-core/src/types/Math.sol";
import { IERC20 } from "@sablier/v2-core/src/types/Tokens.sol";

contract StreamCreator {
IERC20 public constant DAI = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
Expand All @@ -30,6 +30,7 @@ contract StreamCreator {
params.totalAmount = uint128(totalAmount); // Total amount is the amount inclusive of all fees
params.asset = DAI; // The streaming asset
params.cancelable = true; // Whether the stream will be cancelable or not
params.transferable = true; // Whether the stream will be transferable or not
params.durations = LockupLinear.Durations({
cliff: 4 weeks, // Assets will be unlocked only after 4 weeks
total: 52 weeks // Setting a total duration of ~1 year
Expand Down
9 changes: 5 additions & 4 deletions test/StreamCreator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
pragma solidity >=0.8.19;

import { ISablierV2LockupLinear } from "@sablier/v2-core/src/interfaces/ISablierV2LockupLinear.sol";
import { Test } from "forge-std/Test.sol";
import { PRBTest } from "@prb/test/src/PRBTest.sol";
import { StdCheats } from "forge-std/src/StdCheats.sol";

import { StreamCreator } from "../src/StreamCreator.sol";

contract StreamCreatorTest is Test {
contract StreamCreatorTest is PRBTest, StdCheats {
// Get the latest deployment address from the docs: https://docs.sablier.com/contracts/v2/deployments
address internal constant SABLIER_ADDRESS = address(0xB10daee1FCF62243aE27776D7a92D39dC8740f95);
address internal constant SABLIER_ADDRESS = address(0xe99AEff5BB41d0d7340e7B0c8001F593768ba0E5);

// Test contracts
StreamCreator internal creator;
Expand All @@ -17,7 +18,7 @@ contract StreamCreatorTest is Test {

function setUp() public {
// Fork Ethereum Mainnet
vm.createSelectFork({ blockNumber: 17_614_000, urlOrAlias: "mainnet" });
vm.createSelectFork({ blockNumber: 18_809_500, urlOrAlias: "mainnet" });

// Load the Sablier contract from Ethereum Mainnet
sablier = ISablierV2LockupLinear(SABLIER_ADDRESS);
Expand Down