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

added: IBatch Interface #326

Merged
merged 3 commits into from
Nov 3, 2024
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: 3 additions & 3 deletions src/SablierFlow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import { Broker, Flow } from "./types/DataTypes.sol";
/// @title SablierFlow
/// @notice See the documentation in {ISablierFlow}.
contract SablierFlow is
Batch, // 0 inherited components
Batch, // 1 inherited components
NoDelegateCall, // 0 inherited components
ISablierFlow, // 4 inherited components
SablierFlowBase // 8 inherited components
ISablierFlow, // 7 inherited components
SablierFlowBase // 5 inherited components
{
using SafeCast for uint256;
using SafeERC20 for IERC20;
Expand Down
10 changes: 5 additions & 5 deletions src/abstracts/Batch.sol
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22;

import { IBatch } from "../interfaces/IBatch.sol";
import { Errors } from "../libraries/Errors.sol";

/// @title Batch
/// @notice This contract implements logic to batch call any function.
/// @notice See the documentation in {IBatch}.
/// @dev Forked from: https://github.com/boringcrypto/BoringSolidity/blob/master/contracts/BoringBatchable.sol
abstract contract Batch {
abstract contract Batch is IBatch {
/*//////////////////////////////////////////////////////////////////////////
USER-FACING NON-CONSTANT FUNCTIONS
//////////////////////////////////////////////////////////////////////////*/

/// @notice Allows batched call to self, `this` contract.
/// @param calls An array of inputs for each call.
function batch(bytes[] calldata calls) external {
/// @inheritdoc IBatch
function batch(bytes[] calldata calls) external override {
uint256 count = calls.length;

for (uint256 i = 0; i < count; ++i) {
Expand Down
9 changes: 9 additions & 0 deletions src/interfaces/IBatch.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.22;

/// @notice This contract implements logic to batch call any function.
interface IBatch {
/// @notice Allows batched call to self, `this` contract.
/// @param calls An array of inputs for each call.
function batch(bytes[] calldata calls) external;
}
4 changes: 3 additions & 1 deletion src/interfaces/ISablierFlow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { UD21x18 } from "@prb/math/src/UD21x18.sol";

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

/// @title ISablierFlow
/// @notice Creates and manages Flow streams with linear streaming functions.
interface ISablierFlow is
ISablierFlowBase // 4 inherited component
IBatch, // 0 inherited interface
ISablierFlowBase // 5 inherited component
{
/*//////////////////////////////////////////////////////////////////////////
EVENTS
Expand Down
1 change: 0 additions & 1 deletion src/interfaces/ISablierFlowBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ 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 { UD60x18 } from "@prb/math/src/UD60x18.sol";

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