Skip to content

Commit f9f611b

Browse files
authored
Readme fix and Docker build (#35)
* Readme fix and Docker build * adding flow api, bot
1 parent 769ed86 commit f9f611b

File tree

168 files changed

+14913
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+14913
-86
lines changed

README.md

+33-81
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Chainflow Automation Platform
1+
# Guru Framework
22

33
## Table of Contents
44
- [Introduction](#introduction)
@@ -11,111 +11,61 @@
1111
- [Contributing](#contributing)
1212

1313

14-
# Introduction
15-
16-
Introducing our cutting-edge Web3 Automation platform, built on the robust Guru Network. This platform leverages
17-
advanced data warehouse feeds to empower users with data-rich decision-making capabilities for a variety of automation
18-
scenarios, including DeFi applications.
19-
Key Features
20-
21-
**Data-Driven Decision Making:** Utilize our comprehensive data warehouse feeds that aggregate and process vast amounts
22-
of information, ensuring your automation decisions are informed by the latest and most relevant data.
23-
Seamless Integration with DeFi: Specifically tailored for DeFi scenarios, our platform allows users to automate complex
24-
financial workflows, optimize investment strategies, and manage assets with precision and efficiency.
25-
User-Centric Automation: Design personalized automation flows that cater to individual or business needs, enabling
26-
better control over financial activities and operations.
27-
Advanced AI Orchestration: At the heart of our platform is AI-driven orchestration, which integrates seamlessly both
28-
on-chain and off-chain elements, ensuring smooth and intelligent operational flows.
29-
Benefits
30-
31-
**Enhanced Operational Efficiency:** Automate routine and complex tasks, reducing the need for manual intervention and
32-
allowing more time for strategic decision-making.
33-
Improved Accuracy and Speed: With data-driven insights at your disposal, make faster and more accurate decisions that
34-
align with market dynamics and your strategic goals.
35-
Scalability: Whether scaling operations, managing more assets, or integrating new tools, our platform grows with your
36-
needs, providing robust scalability and adaptability.
37-
Security and Reliability: Built on the secure and reliable Guru Network, our platform ensures that your data and
38-
automated processes are protected against threats and disruptions.
39-
Use Cases
40-
41-
**Automated Trading**: Implement sophisticated trading strategies that react in real-time to market changes and optimize
42-
returns.
43-
Risk Management: Automate risk assessment and management protocols to maintain the health and security of your financial
44-
portfolios.
45-
Portfolio Rebalancing: Utilize AI-driven algorithms to adjust your asset allocations dynamically based on predefined
46-
criteria and market conditions
14+
## Introduction
4715

48-
# Guru Framework
16+
Welcome to the Guru Framework, your ultimate toolkit for building sophisticated Web3 applications. Built on the robust Guru Network, our framework empowers developers with advanced tools for AI orchestration and Web3 automation. Whether you're working on DeFi applications, automated trading, or blockchain integration, the Guru Framework simplifies and enhances your development process.
17+
18+
**Key Features:**
19+
- **Data-Driven Decision Making:** Leverage comprehensive data warehouse feeds for informed automation decisions.
20+
- **Seamless Integration with DeFi:** Automate complex financial workflows and optimize investment strategies.
21+
- **User-Centric Automation:** Create personalized automation flows for various financial activities and operations.
22+
- **Advanced AI Orchestration:** Integrate on-chain and off-chain elements seamlessly with AI-driven orchestration.
4923

50-
The Guru Framework is an advanced toolkit designed to facilitate the orchestration of complex Web3, Web2, and off-chain
51-
processes. It enables developers and startups to build applications that integrate seamlessly across various
52-
technological environments. The framework encompasses a Blockchain Business Process Automation (BBPA) Engine, Smart
53-
Contracts, a Landing and GUI page, and a unified Telegram bot composer, along with specialized External Workers for
54-
non-custodial execution and compute.
5524

5625
## Components
5726

5827
### BBPA Engine
59-
60-
Located in the `engine` directory, the BBPA Engine is the cornerstone of the framework, managing the automation and
61-
orchestration of blockchain business processes. It allows for efficient integration and management of workflows across
62-
Web3 and Web2 infrastructures.
28+
Located in the `engine` directory, this is the core of the framework, managing the automation and orchestration of blockchain business processes.
6329

6430
### Smart Contracts
31+
Found in the `contracts` directory, these handle secure and efficient decentralized application operations.
6532

66-
The `contracts` directory houses all the smart contracts used within the Guru Framework. These contracts are crucial for
67-
handling operations such as transactions, interactions, and protocol-specific functions, ensuring secure and efficient
68-
decentralized application operations.
33+
### GUI
34+
The `gui` directory contains the user interface components, offering an intuitive graphical interface for managing processes.
6935

70-
### Landing and GUI Page
36+
### Flow API
37+
The Flow API in the `flow_api` directory provides endpoints for creating and managing workflows programmatically.
7138

72-
Found under the `gui` directory, this component offers the user interface for the Guru Framework. It provides an
73-
intuitive graphical interface for users to easily interact with the underlying systems, facilitating the management and
74-
orchestration of complex processes.
39+
### Telegram Bot Unified Composer
40+
Integrated into the framework, this tool allows the creation of Telegram bots to control and manage processes.
7541

7642
### External Workers
43+
Defined in the `external_workers` directory, these provide non-custodial execution and compute services.
7744

78-
External Workers are defined in the `external_workers` directory. These are individual agents that provide non-custodial
79-
execution and compute services, enabling secure and decentralized processing without requiring custody of user data or
80-
assets.
81-
82-
### Telegram Bot Unified Composer
83-
84-
This tool, integrated into the framework, allows developers to create Telegram bots that can control and manage
85-
processes within the Guru Framework. It simplifies the development and integration of Telegram as an interactive layer
86-
for applications, enhancing user engagement and process management.
45+
### Orchestration Workers Contracts
46+
Located in the `orchestration_workers` directory, these contracts facilitate workflow orchestration.
8747

8848
## Project Structure
8949

50+
9051
```
9152
guru-framework/
9253
9354
├── contracts/ # Smart contracts for blockchain interactions
9455
├── engine/ # Core BBPA engine for process automation
9556
├── external_workers/ # Individual agents for non-custodial execution and compute
57+
├── flow_api/ # API for managing and integrating workflows
58+
├── bot/ # Telegram bot unified composer
9659
├── gui/ # User interface components
9760
└── README.md # This file
9861
```
9962

100-
# Getting Started
101-
102-
To begin using the Guru Framework, clone the repository and follow the setup instructions provided in each component's
103-
directory.
63+
## Getting Started
10464

105-
```bash
106-
git clone https://github.com/dex-guru/guru-framework.git
107-
cd guru-framework
108-
```
109-
110-
**Repository URL:** [GURU Framework](https://github.com/dex-guru/guru-framework)
65+
To begin using the Guru Framework, follow these steps:
11166

11267
### Prerequisites
113-
Make sure you have Docker and Docker Compose installed on your machine.
114-
115-
**Subdirectories:**
116-
- `engine`
117-
- `gui`
118-
- `external_workers`
68+
Ensure you have Docker and Docker Compose installed.
11969

12070
**Steps:**
12171

@@ -198,7 +148,7 @@ chainflow-gui ./entrypoint.sh npm start Up 0.0.0.0:30
198148

199149
### Step-by-Step Guide:
200150

201-
Create Process in Camunda Modeler:
151+
Create Process in [Camunda Modeler](https://camunda.com/download/modeler/):
202152

203153
Design your process in Camunda Modeler.
204154
Save the BPMN file to engine/resources directory.
@@ -207,8 +157,10 @@ Save the BPMN file to engine/resources directory.
207157

208158
#### Create Non-Custodial External Worker in Python:
209159

210-
Create a Python script for the external worker.
211-
Example code from external_workers/testnet_arbitrage/get_last_price.py:
160+
**Create Non-Custodial External Worker in Python:**
161+
1. Create a Python script for the external worker.
162+
2. Example code from `external_workers/testnet_arbitrage/get_last_price.py`:
163+
212164
```python
213165
from camunda.external_task.external_task import ExternalTask, TaskResult
214166
from camunda.external_task.external_task_worker import ExternalTaskWorker
@@ -230,8 +182,8 @@ worker.subscribe("get-last-price", handle_task)
230182
231183
### Create Postgres Model Code:
232184
233-
Define your database models.
234-
Example code for an arbitrage bot model:
185+
1. Define your database models.
186+
2. Example code for an arbitrage bot model:
235187
```python
236188
Copy code
237189
from sqlalchemy import Column, Integer, String, Float, create_engine

bot/.dockerignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ignore all files
2+
**
3+
4+
# exclusion
5+
!/bot_server/
6+
!/camunda_client/
7+
!/flow_client/
8+
9+
!/alembic.ini
10+
!/requirements.txt
11+

bot/.env.example

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Telegram Bot Settings
2+
# Bmeme stage
3+
BOT_TOKEN="BOT_TOKEN"
4+
SUPPORT_URL="dex.guru"
5+
RATE_LIMIT=0.5
6+
DEBUG=True
7+
# Webhook Server Settings (Optional)
8+
USE_WEBHOOK=False
9+
WEBHOOK_HOST="0.0.0.0" # use "localhost" if not using Docker
10+
WEBHOOK_PORT=8080
11+
WEBHOOK_BASE_URL="https://example.com"
12+
WEBHOOK_PATH="/webhook"
13+
WEBHOOK_SECRET="Pl7U9AJUFb2"
14+
15+
16+
FLOW_API="http://flow-api"
17+
FLOW_SYS_KEY="secret"
18+
19+
ENGINE_ADMIN_PREFIX="http://engine"
20+
ENGINE_URL="http://engine/engine-rest"
21+
ENGINE_USERNAME="demo"
22+
ENGINE_PASSWORD="demo"
23+
ENGINE_USERS_GROUP_ID="camunda-admin"
24+
25+
# Redis (for FSM and Cache) Settings
26+
REDIS_HOST="localhost" # use "localhost" if not using Docker
27+
REDIS_PORT=6379
28+
REDIS_PASS=
29+
30+
# External Services Settings (API Keys for example)
31+
SENTRY_DSN=""
32+
AMPLITUDE_API_KEY=""
33+
POSTHOG_API_KEY=""
34+
35+
# Performance Monitoring System Settings
36+
PROMETHEUS_PORT=9090
37+
GRAFANA_PORT=3000
38+
GRAFANA_ADMIN_USER="admin"
39+
GRAFANA_ADMIN_PASSWORD="admin"

bot/.gitignore

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/
130+
131+
# Pycharm
132+
.idea/
133+
134+
.DS_Store
135+
136+
logs/
137+
138+

bot/.pre-commit-config.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
- id: check-merge-conflict
10+
- id: check-byte-order-marker
11+
- id: debug-statements
12+
- id: detect-private-key
13+
- id: check-ast
14+
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
rev: v0.1.13
17+
hooks:
18+
- id: ruff
19+
- id: ruff-format

0 commit comments

Comments
 (0)