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

Merge Develop to Master #32

Draft
wants to merge 10 commits into
base: v3-master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
.env.*
virtualenv
venv
__pycache__
__pycache__/
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM dipdup/dipdup:6.1.2
FROM dipdup/dipdup:6.5.7

COPY requirements.txt .

RUN pip3 install -r requirements.txt

COPY . .
COPY --chown=dipdup . .
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2023 dOrg, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,44 @@
homebase-indexer
# Homebase Indexer

## Overview
**Homebase Indexer** is a specialized tool crafted using DipDup, Tezos's Python framework. It serves as an equivalent to [a subgraph](https://thegraph.com/) and provides a GraphQL API, enabling efficient interaction with the Tezos blockchain. Primarily driven by the `dipdup.yml` file, it efficiently handles contract events. The main branches for the current version are `v3-master` and `v3-develop` (production and development respectively), although version 2 branches are still maintained for some DAOs that have not transitioned to version 3.

## Prerequisites
Before installing Homebase Indexer, ensure you have the following:
- Python 3.8 or higher
- Docker and Docker Compose
- Basic understanding of blockchain concepts and Tezos

## Installation and Setup
1. **Clone the Repository**: `git clone https://github.com/dOrgTech/homebase-indexer.git -b v3-develop`
2. **Navigate to the Project Directory**: `cd homebase-indexer`
3. **Build the Docker Image**: `docker build -t homebase-indexer .`
4. **Initialize Using Docker Compose**: `docker-compose up`

## Usage
To run the Homebase Indexer:
```
docker-compose up
```
This will start the indexer and initiate syncing with the Tezos node as per the configuration.

## Configuration
Configure the indexer using the `dipdup.yml` file. For advanced settings and customization, refer to the [DipDup's documentation](https://docs.dipdup.io).

## Contribution Guidelines
Contributions are welcome! To contribute:
1. Fork the repository
2. Create a new branch for your feature
3. Commit your changes
4. Push to the branch
5. Open a pull request

## Troubleshooting
- **Issue**: Docker build fails.
**Solution**: Ensure Docker is running and you have the necessary permissions.

- **Issue**: Indexer not syncing.
**Solution**: Check the `dipdup.yml` configuration and ensure network connectivity.

## License
Homebase Indexer is licensed under [MIT License](LICENSE).
100 changes: 10 additions & 90 deletions dipdup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ advanced:

contracts:
registry_mainnet:
address: KT1MFxwTan4ptw6PSc3KK6e1xfzMrCb382tw
code_hash: KT1MFxwTan4ptw6PSc3KK6e1xfzMrCb382tw
typename: registry
registry_ghostnet:
address: KT1QZtF8vVUvZYRxttRwgftc4EaQHZWgzXNp
code_hash: KT1QZtF8vVUvZYRxttRwgftc4EaQHZWgzXNp
typename: registry

datasources:
Expand Down Expand Up @@ -86,93 +86,13 @@ templates:

indexes:
factory_mainnet:
kind: operation
datasource: tzkt_mainnet
types:
- origination
handlers:
- callback: on_factory_origination
pattern:
- type: origination
similar_to: registry_mainnet
- callback: on_propose
pattern:
- type: transaction
destination: registry_mainnet
entrypoint: propose
- callback: on_vote
pattern:
- type: transaction
destination: registry_mainnet
entrypoint: vote
- callback: on_drop_proposal
pattern:
- type: transaction
destination: registry_mainnet
entrypoint: drop_proposal
- callback: on_unstake_vote
pattern:
- type: transaction
destination: registry_mainnet
entrypoint: unstake_vote
- callback: on_flush
pattern:
- type: transaction
destination: registry_mainnet
entrypoint: flush
- callback: on_freeze
pattern:
- type: transaction
destination: registry_mainnet
entrypoint: freeze
- callback: on_unfreeze
pattern:
- type: transaction
destination: registry_mainnet
entrypoint: unfreeze
template: registry_dao
values:
datasource: tzkt_mainnet
contract: registry_mainnet

factory_ghostnet:
kind: operation
datasource: tzkt_ghostnet
types:
- origination
handlers:
- callback: on_factory_origination
pattern:
- type: origination
similar_to: registry_ghostnet
- callback: on_propose
pattern:
- type: transaction
destination: registry_ghostnet
entrypoint: propose
- callback: on_vote
pattern:
- type: transaction
destination: registry_ghostnet
entrypoint: vote
- callback: on_drop_proposal
pattern:
- type: transaction
destination: registry_ghostnet
entrypoint: drop_proposal
- callback: on_unstake_vote
pattern:
- type: transaction
destination: registry_ghostnet
entrypoint: unstake_vote
- callback: on_flush
pattern:
- type: transaction
destination: registry_ghostnet
entrypoint: flush
- callback: on_freeze
pattern:
- type: transaction
destination: registry_ghostnet
entrypoint: freeze
- callback: on_unfreeze
pattern:
- type: transaction
destination: registry_ghostnet
entrypoint: unfreeze
template: registry_dao
values:
datasource: tzkt_ghostnet
contract: registry_ghostnet
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
- HASURA_GRAPHQL_UNAUTHORIZED_ROLE=indexer
- HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES=true
image: hasura/graphql-engine:v2.8.3.cli-migrations-v3
restart: always
db:
container_name: hb-indexer-postgres
ports:
Expand Down
Binary file removed registrydao/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file removed registrydao/__pycache__/models.cpython-38.pyc
Binary file not shown.
5 changes: 0 additions & 5 deletions registrydao/handlers/on_factory_origination.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ async def on_factory_origination(
network = extract_network_from_ctx(ctx)

if index_name not in ctx.config.indexes:
await ctx.add_contract(
name=originated_contract,
address=originated_contract,
typename='registry',
)
await ctx.add_index(
name=index_name,
template='registry_dao',
Expand Down
144 changes: 72 additions & 72 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
aiohttp==3.8.1
aiolimiter==1.0.0
aiosignal==1.2.0
aiosqlite==0.17.0
anyio==3.5.0
appdirs==1.4.4
APScheduler==3.9.1
argcomplete==2.0.0
async-timeout==4.0.2
asyncclick==8.0.3.2
asyncpg==0.26.0
attrs==21.4.0
black==22.3.0
certifi==2021.10.8
chardet==4.0.0
charset-normalizer==2.0.12
click==8.1.2
datamodel-code-generator==0.13.1
dipdup==6.1.2
dnspython==2.2.1
email-validator==1.2.0
fcache==0.4.7
frozenlist==1.3.0
genson==1.2.2
idna==3.3
inflect==5.5.2
iso8601==1.0.2
isodate==0.6.1
isort==5.10.1
Jinja2==3.1.1
jsonschema==3.2.0
MarkupSafe==2.1.1
msgpack==1.0.3
multidict==6.0.2
mypy-extensions==0.4.3
openapi-schema-validator==0.1.6
openapi-spec-validator==0.3.3
orjson==3.6.8
pathspec==0.9.0
platformdirs==2.5.2
prance==0.21.8.0
prometheus-client==0.14.1
pydantic==1.9.2
pyhumps==3.5.3
pypika-tortoise==0.1.6
pyrsistent==0.16.1
pysignalr==0.1.2
PySnooper==1.1.1
python-dotenv==0.19.2
pytz==2022.1
pytz-deprecation-shim==0.1.0.post0
PyYAML==6.0
requests==2.27.1
ruamel.yaml==0.17.21
ruamel.yaml.clib==0.2.6
semver==2.13.0
sentry-sdk==1.5.10
six==1.16.0
sniffio==1.2.0
sqlparse==0.4.2
tabulate==0.8.9
toml==0.10.2
tomli==2.0.1
tortoise-orm==0.19.2
typed-ast==1.5.3
typing-inspect==0.6.0
typing_extensions==4.2.0
tzdata==2022.1
tzlocal==4.2
urllib3==1.26.9
websockets==10.3
yarl==1.7.2
dipdup==6.5.7
aiohttp
aiolimiter
aiosignal
aiosqlite
anyio
appdirs
APScheduler
argcomplete
async-timeout
asyncclick
asyncpg
attrs
black
certifi
chardet
charset-normalizer
click
datamodel-code-generator
dnspython
email-validator
fcache
frozenlist
genson
idna
inflect
iso8601
isodate
isort
Jinja2
jsonschema
MarkupSafe
msgpack
multidict
mypy-extensions
openapi-schema-validator
openapi-spec-validator
orjson
pathspec
platformdirs
prance
prometheus-client
pydantic
pyhumps
pypika-tortoise
pyrsistent
pysignalr
PySnooper
python-dotenv
pytz
pytz-deprecation-shim
PyYAML
requests
ruamel.yaml
ruamel.yaml.clib
semver
sentry-sdk
six
sniffio
sqlparse
tabulate
toml
tomli
tortoise-orm
typed-ast
typing-inspect
typing_extensions
tzdata
tzlocal
urllib3
websockets
yarl