Skip to content

Commit

Permalink
Initial Commit v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaammerr committed Apr 3, 2024
0 parents commit 4da2187
Show file tree
Hide file tree
Showing 51 changed files with 4,541 additions and 0 deletions.
161 changes: 161 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Byte-compiled / optimized / DLL files
__pycache__/
.idea/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.11
LABEL authors="Jammer"

WORKDIR /usr/src/app

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

RUN apt -qq update
COPY requirements.txt .

RUN pip install --upgrade pip
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY ../.. .
CMD ["python", "./run.py"]
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

# MintChain Daily Bot

## 🔗 Links

🔔 CHANNEL: https://t.me/JamBitPY

💬 CHAT: https://t.me/JamBitChat

💰 DONATION EVM ADDRESS: 0x08e3fdbb830ee591c0533C5E58f937D312b07198


## 🤖 | Features:

- **Auto registration**
- **Auto bind referral**
- **Auto bind twitter**
- **Auto collect daily rewards every X time**


## 🚀 Installation

``Docker``


``1. Close the repo and open CMD (console) inside it``

``2. Setup configuration and accounts``

``3. Run: docker-compose up -d --build``

``OR``


`` Required python >= 3.10``

``1. Close the repo and open CMD (console) inside it``

``2. Install requirements: pip install -r requirements.txt``

``3. Setup configuration and accounts``

``4. Run: python run.py``


## ⚙️ Config (config > settings.yaml)

| Name | Description |
| --- |----------------------------------------------------------------------------------------------------|
| referral_code | Your referral code |
| rpc_url | RPC URL (if not have, leave the default value) |
| iteration_delay | Delay between iterations in hours (Let's say every 24 hours the script will collect daily rewards) |


## ⚙️ Accounts format (config > accounts.txt)

- twitter_auth_token|wallet_mnemonic|proxy
- twitter_auth_token|wallet_mnemonic

`` Proxy format: IP:PORT:USER:PASS``
1 change: 1 addition & 0 deletions config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .load_config import load_config
7 changes: 7 additions & 0 deletions config/accounts.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
auth_token|mnemonic|proxy
auth_token|mnemonic|proxy
auth_token|mnemonic|proxy
auth_token|mnemonic|proxy
auth_token|mnemonic|proxy
auth_token|mnemonic|proxy
auth_token|mnemonic|proxy
66 changes: 66 additions & 0 deletions config/load_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import os
import yaml

from loguru import logger
from models import Account, Config


def get_accounts() -> Account:
accounts_path = os.path.join(os.path.dirname(__file__), "accounts.txt")
if not os.path.exists(accounts_path):
logger.error(f"File <<{accounts_path}>> does not exist")
exit(1)

with open(accounts_path, "r") as f:
accounts = f.readlines()

if not accounts:
logger.error(f"File <<{accounts_path}>> is empty")
exit(1)

for account in accounts:
values = account.split("|")
if len(values) == 2:
yield Account(auth_token=values[0].strip(), mnemonic=values[1].strip())

elif len(values) == 3:
yield Account(
auth_token=values[0].strip(),
mnemonic=values[1].strip(),
proxy=values[2].strip(),
)

else:
logger.error(
f"Account <<{account}>> is not in correct format | Need to be in format: <<auth_token|mnemonic|proxy>>"
)
exit(1)


def load_config() -> Config:
settings_path = os.path.join(os.path.dirname(__file__), "settings.yaml")
if not os.path.exists(settings_path):
logger.error(f"File <<{settings_path}>> does not exist")
exit(1)

with open(settings_path, "r") as f:
settings = yaml.safe_load(f)

if not settings.get("referral_code"):
logger.error(f"Referral code is not provided in settings.yaml")
exit(1)

if not settings.get("rpc_url"):
logger.error(f"RPC URL is not provided in settings.yaml")
exit(1)

if not settings.get("iteration_delay"):
logger.error(f"Iteration delay is not provided in settings.yaml")
exit(1)

return Config(
accounts=list(get_accounts()),
referral_code=settings["referral_code"],
rpc_url=settings["rpc_url"],
iteration_delay=settings["iteration_delay"],
)
3 changes: 3 additions & 0 deletions config/settings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
referral_code: C4ACD869 # Referral code (If you don't have one, pls, use mine)
rpc_url: https://eth.llamarpc.com # RPC URL (Ethereum)
iteration_delay: 6 # hours
10 changes: 10 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
app:
build: ./
container_name: MintChainBot
deploy:
restart_policy:
condition: on-failure
delay: 3s
max_attempts: 5
window: 60s
4 changes: 4 additions & 0 deletions loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from models import Config
from config import load_config

config: Config = load_config()
4 changes: 4 additions & 0 deletions models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .api import *
from .wallet import *
from .account import *
from .config import *
34 changes: 34 additions & 0 deletions models/account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from loguru import logger
from pydantic import BaseModel, field_validator


class Account(BaseModel):
auth_token: str
mnemonic: str
proxy: str = None

@field_validator("mnemonic", mode="before")
def check_mnemonic(cls, value) -> str | None:
words = value.split(" ")
if len(words) not in (12, 24):
logger.error(
f"Mnemonic <<{value}>> is not in correct format | Need to be 12/24 words"
)
exit(1)

return value

@field_validator("proxy", mode="before")
def check_proxy(cls, value) -> str | None:
if not value:
return None

proxy_values = value.split(":")
if len(proxy_values) != 4:
logger.error(
f"Proxy <<{value}>> is not in correct format | Need to be in format: <<ip:port:username:password>>"
)
exit(1)

proxy_url = f"http://{proxy_values[2]}:{proxy_values[3]}@{proxy_values[0]}:{proxy_values[1]}"
return proxy_url
Loading

0 comments on commit 4da2187

Please sign in to comment.