contract BaseBoringBatchable {
    /// @dev Helper function to extract a useful revert message from a failed call.
    function _getRevertMsg(bytes memory _returnData) private pure returns (string memory) {
        if (_returnData.length < 68) return "Transaction reverted silently"; // if length is less than 68, tx failed w/o revert message
        assembly { _returnData := add(_returnData, 0x04) } // slice the sighash
        return abi.decode(_returnData, (string)); // all that remains is the revert string
    }

    /// @notice Allows batched call to self (this contract).
    /// @param calls An array of inputs for each call.
    /// @param revertOnFail If 'true', reverts after a failed call and stops further calls.
    function batch(bytes[] calldata calls, bool revertOnFail) external {
        for (uint256 i = 0; i < calls.length; i++) {
            (bool success, bytes memory result) = address(this).delegatecall(calls[i]);
            if (!success && revertOnFail) revert(_getRevertMsg(result));
        }
    }
}
/// @dev Adapted for Meowshi.
function batch(bytes[] calldata calls, bool revertOnFail) external {
    for (uint256 i = 0; i < calls.length; i++) {
        (bool success, bytes memory result) = address(this).delegatecall(calls[i]);
        if (!success && revertOnFail) revert(_getRevertMsg(result));
    }
}

/// @notice Allows batched call to self (this contract).
/// @param calls An array of inputs for each call.
/// @param revertOnFail If 'true', reverts after a failed call and stops further calls.