Skip to content

Commit

Permalink
added: IBatch Interface (#326)
Browse files Browse the repository at this point in the history
* Created IBatch interface and inherited it into ISablierFlowBase interface

* address my feedback

* chore: update inherited components

---------

Co-authored-by: TheMarvelFan <nigampranshu665@gmail.com>
Co-authored-by: andreivladbrg <andreivladbrg@gmail.com>
Co-authored-by: smol-ninja <shubhamy2015@gmail.com>
  • Loading branch information
4 people authored Nov 3, 2024
1 parent 5b3e293 commit bdd2c99
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
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

0 comments on commit bdd2c99

Please sign in to comment.