Skip to content

Commit

Permalink
build: install evm utils dep
Browse files Browse the repository at this point in the history
refactor: remove Adminable, Batch and NoDelegateCall
refactor: remove BaseScript
test: use common base logic in tests
  • Loading branch information
andreivladbrg committed Feb 5, 2025
1 parent 460b9f9 commit bc49179
Show file tree
Hide file tree
Showing 50 changed files with 110 additions and 587 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"devDependencies": {
"forge-std": "github:foundry-rs/forge-std#v1.8.2",
"evm-utils": "github:sablier-labs/evm-utils#d81edd1",
"husky": "^9.1.4",
"lint-staged": "^15.2.8",
"prettier": "^3.3.2",
Expand Down
3 changes: 2 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
@prb/math/=node_modules/@prb/math/
@sablier/evm-utils/=node_modules/evm-utils/
forge-std/=node_modules/forge-std/
solady/=node_modules/solady/
solady/=node_modules/solady/
94 changes: 0 additions & 94 deletions script/Base.s.sol

This file was deleted.

4 changes: 2 additions & 2 deletions script/DeployDeterministicFlow.s.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22;

import { BaseScript } from "@sablier/evm-utils/script/Base.s.sol";

import { FlowNFTDescriptor } from "src/FlowNFTDescriptor.sol";
import { FlowNFTDescriptor } from "src/FlowNFTDescriptor.sol";
import { SablierFlow } from "src/SablierFlow.sol";

import { BaseScript } from "./Base.s.sol";

/// @notice Deploys {SablierFlow} at a deterministic address across chains.
/// @dev Reverts if the contract has already been deployed.
contract DeployDeterministicFlow is BaseScript {
Expand Down
4 changes: 2 additions & 2 deletions script/DeployFlow.s.sol
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22;

import { BaseScript } from "@sablier/evm-utils/script/Base.s.sol";

import { FlowNFTDescriptor } from "src/FlowNFTDescriptor.sol";
import { FlowNFTDescriptor } from "src/FlowNFTDescriptor.sol";
import { SablierFlow } from "src/SablierFlow.sol";

import { BaseScript } from "./Base.s.sol";

/// @notice Deploys {SablierFlow}.
contract DeployFlow is BaseScript {
function run() public returns (SablierFlow flow, FlowNFTDescriptor nftDescriptor) {
Expand Down
4 changes: 2 additions & 2 deletions src/SablierFlow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.s
import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol";
import { ud21x18, UD21x18 } from "@prb/math/src/UD21x18.sol";
import { Batch } from "@sablier/evm-utils/src/Batch.sol";
import { NoDelegateCall } from "@sablier/evm-utils/src/NoDelegateCall.sol";

import { Batch } from "./abstracts/Batch.sol";
import { NoDelegateCall } from "./abstracts/NoDelegateCall.sol";
import { SablierFlowBase } from "./abstracts/SablierFlowBase.sol";
import { IFlowNFTDescriptor } from "./interfaces/IFlowNFTDescriptor.sol";
import { ISablierFlow } from "./interfaces/ISablierFlow.sol";
Expand Down
41 changes: 0 additions & 41 deletions src/abstracts/Adminable.sol

This file was deleted.

39 changes: 0 additions & 39 deletions src/abstracts/Batch.sol

This file was deleted.

34 changes: 0 additions & 34 deletions src/abstracts/NoDelegateCall.sol

This file was deleted.

6 changes: 2 additions & 4 deletions src/abstracts/SablierFlowBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import { IERC721Metadata } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import { UD21x18 } from "@prb/math/src/UD21x18.sol";
import { Adminable } from "@sablier/evm-utils/src/Adminable.sol";

import { IFlowNFTDescriptor } from "./../interfaces/IFlowNFTDescriptor.sol";
import { ISablierFlowBase } from "./../interfaces/ISablierFlowBase.sol";
import { Errors } from "./../libraries/Errors.sol";
import { Flow } from "./../types/DataTypes.sol";
import { Adminable } from "./Adminable.sol";

/// @title SablierFlowBase
/// @notice See the documentation in {ISablierFlowBase}.
Expand Down Expand Up @@ -46,11 +46,9 @@ abstract contract SablierFlowBase is
/// @dev Emits {TransferAdmin} event.
/// @param initialAdmin The address of the initial contract admin.
/// @param initialNFTDescriptor The address of the initial NFT descriptor.
constructor(address initialAdmin, IFlowNFTDescriptor initialNFTDescriptor) {
constructor(address initialAdmin, IFlowNFTDescriptor initialNFTDescriptor) Adminable(initialAdmin) {
nextStreamId = 1;
admin = initialAdmin;
nftDescriptor = initialNFTDescriptor;
emit TransferAdmin({ oldAdmin: address(0), newAdmin: initialAdmin });
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down
41 changes: 0 additions & 41 deletions src/interfaces/IAdminable.sol

This file was deleted.

12 changes: 0 additions & 12 deletions src/interfaces/IBatch.sol

This file was deleted.

2 changes: 1 addition & 1 deletion src/interfaces/ISablierFlow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity >=0.8.22;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { UD21x18 } from "@prb/math/src/UD21x18.sol";
import { IBatch } from "@sablier/evm-utils/src/interfaces/IBatch.sol";

import { Flow } from "./../types/DataTypes.sol";
import { IBatch } from "./IBatch.sol";
import { ISablierFlowBase } from "./ISablierFlowBase.sol";

/// @title ISablierFlow
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/ISablierFlowBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IERC721Metadata } from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import { UD21x18 } from "@prb/math/src/UD21x18.sol";
import { IAdminable } from "@sablier/evm-utils/src/interfaces/IAdminable.sol";

import { Flow } from "./../types/DataTypes.sol";
import { IAdminable } from "./IAdminable.sol";
import { IFlowNFTDescriptor } from "./IFlowNFTDescriptor.sol";

/// @title ISablierFlowBase
Expand Down
13 changes: 0 additions & 13 deletions src/libraries/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ import { UD21x18 } from "@prb/math/src/UD21x18.sol";
/// @title Errors
/// @notice Library with custom errors used across the Flow contract.
library Errors {
/*//////////////////////////////////////////////////////////////////////////
GENERICS
//////////////////////////////////////////////////////////////////////////*/

/// @notice Thrown when an unexpected error occurs during a batch call.
error BatchError(bytes errorData);

/// @notice Thrown when `msg.sender` is not the admin.
error CallerNotAdmin(address admin, address caller);

/// @notice Thrown when trying to delegate call to a function that disallows delegate calls.
error DelegateCall();

/*//////////////////////////////////////////////////////////////////////////
SABLIER-FLOW
//////////////////////////////////////////////////////////////////////////*/
Expand Down
Loading

0 comments on commit bc49179

Please sign in to comment.