Skip to content

Commit

Permalink
Add filter by contract code hash to operation index (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout authored Dec 9, 2022
1 parent f713eae commit 0f3de55
Show file tree
Hide file tree
Showing 581 changed files with 4,509 additions and 26,900 deletions.
28 changes: 26 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,37 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning].

## [Unreleased]
## [6.4.0rc1] - 2022-12-09

## Added

- config: Added optional `code_hash` field to contract config.
- context: Added `first_level` and `last_level` arguments to `ctx.add_index` methods.
- index: Filtering by `code_hash` is available for `operation` index.
- tzkt: Added datasource methods `get_contract_address` and `get_contract_hashes`.
- tzkt: Originations and operations now can be fetched by contract code hashes.
- tzkt: Added `sender_code_hash` and `target_code_hash` fields to `OperationData` model.

### Fixed

- codegen: Unresolved index templates are now correctly processed during types generation.
- demos: Fixed outdated `demo_dao` project.
- http: Fixed a crash when datasource URL contains trailing slash.
- metadata: Add `limanet` to supported networks.
- projects: Do not scaffold an outdated `poetry.lock`.

### Changed

- demos: Demos were renamed to better indicate their purpose.
- exceptions: `FrameworkException` is raised instead of plain `RuntimeError` when a framework error occurs.
- exceptions: Known exceptions are inherited from `FrameworkError`.
- tzkt: Some datasource methods have changed their signatures.

### Deprecated

- config: `similar_to.address` filter is an alias for `originated_contract.code_hash` and will be removed in the next major release.
- config: `DipDupError` is an alias for `FrameworkError` and will be removed in the next major release.

## [6.3.1] - 2022-11-25

### Fixed
Expand Down Expand Up @@ -848,7 +871,8 @@ This release contains no changes except for the version number.
[semantic versioning]: https://semver.org/spec/v2.0.0.html

<!-- Versions -->
[Unreleased]: https://github.com/dipdup-io/dipdup/compare/6.3.1...HEAD
[Unreleased]: https://github.com/dipdup-io/dipdup/compare/6.4.0rc1...HEAD
[6.4.0rc1]: https://github.com/dipdup-io/dipdup/compare/6.3.1...6.4.0rc1
[6.3.1]: https://github.com/dipdup-io/dipdup/compare/6.3.0...6.3.1
[6.3.0]: https://github.com/dipdup-io/dipdup/compare/6.2.0...6.3.0
[6.2.0]: https://github.com/dipdup-io/dipdup/compare/6.1.3...6.2.0
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ update: ## Update dependencies, export requirements.txt
scripts:
python scripts/update_cookiecutter.py
python scripts/update_demos.py
make lint

rm -r tests/replays/*
make lint test
make test

##
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ build: ## Build Python wheel package
poetry build

image: ## Build Docker image
docker buildx build . -t demo-tzcolors:${TAG}
docker buildx build . -t demo-auction:${TAG}

clean: ## Remove all files from .gitignore except for `.venv`
git clean -xdf --exclude=".venv"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# demo-tzcolors
# demo-auction

My shiny new indexer based on DipDup

## First steps

* Install Poetry and GNU Make
* Enter the project's directory with `cd demo-tzcolors`
* Enter the project's directory with `cd demo-auction`
* Install required dependencies with `make install`
* Generate types and handlers with `dipdup init`
* Ensure generated project is valid with `make lint`
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions demos/demo-tzcolors/dipdup.yml → demos/demo-auction/dipdup.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
spec_version: 1.2
package: demo_tzcolors
package: demo_auction

database:
kind: sqlite
path: demo-tzcolors.sqlite3
path: demo-auction.sqlite3

contracts:
tzcolors_minter:
Expand All @@ -19,7 +19,7 @@ datasources:
url: ${TZKT_URL:-https://api.tzkt.io}

templates:
tzcolors_auction:
auction:
kind: operation
datasource: <datasource>
contracts:
Expand All @@ -42,8 +42,8 @@ templates:
entrypoint: withdraw

indexes:
tzcolors_auction:
template: tzcolors_auction
tzcolors:
template: auction
values:
datasource: tzkt
minter: tzcolors_minter
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.poetry]
name = "demo-tzcolors"
name = "demo-auction"
version = "0.0.1"
description = "My shiny new indexer based on DipDup"
license = "MIT"
Expand All @@ -8,7 +8,7 @@ authors = [
]
readme = "README.md"
packages = [
{ include = "demo_tzcolors", from = "src" },
{ include = "demo_auction", from = "src" },
]

[tool.poetry.dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"license": "MIT",
"line_length": "120",
"linters": "default",
"package": "demo_tzcolors",
"package": "demo_auction",
"postgresql_image": "postgres:14",
"project_name": "demo-tzcolors",
"template": "demo_tzcolors",
"project_name": "demo-auction",
"template": "demo_auction",
"version": "0.0.1"
}
1 change: 1 addition & 0 deletions demos/demo-auction/src/demo_auction/demo_auction
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import demo_tzcolors.models as models
from demo_tzcolors.types.tzcolors_auction.parameter.bid import BidParameter
from demo_tzcolors.types.tzcolors_auction.storage import TzcolorsAuctionStorage
import demo_auction.models as models
from demo_auction.types.tzcolors_auction.parameter.bid import BidParameter
from demo_auction.types.tzcolors_auction.storage import TzcolorsAuctionStorage
from dipdup.context import HandlerContext
from dipdup.models import Transaction

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import demo_tzcolors.models as models
from demo_tzcolors.types.tzcolors_auction.parameter.create_auction import CreateAuctionParameter
from demo_tzcolors.types.tzcolors_auction.storage import TzcolorsAuctionStorage
import demo_auction.models as models
from demo_auction.types.tzcolors_auction.parameter.create_auction import CreateAuctionParameter
from demo_auction.types.tzcolors_auction.storage import TzcolorsAuctionStorage
from dipdup.context import HandlerContext
from dipdup.models import Transaction

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import demo_tzcolors.models as models
from demo_tzcolors.types.tzcolors_auction.parameter.withdraw import WithdrawParameter
from demo_tzcolors.types.tzcolors_auction.storage import TzcolorsAuctionStorage
import demo_auction.models as models
from demo_auction.types.tzcolors_auction.parameter.withdraw import WithdrawParameter
from demo_auction.types.tzcolors_auction.storage import TzcolorsAuctionStorage
from dipdup.context import HandlerContext
from dipdup.models import Transaction

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from unittest import IsolatedAsyncioTestCase

import demo_tzcolors
import demo_auction


class ExampleTest(IsolatedAsyncioTestCase):
async def test_example(self):
assert demo_tzcolors
assert demo_auction
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ build: ## Build Python wheel package
poetry build

image: ## Build Docker image
docker buildx build . -t demo-quipuswap:${TAG}
docker buildx build . -t demo-big-maps:${TAG}

clean: ## Remove all files from .gitignore except for `.venv`
git clean -xdf --exclude=".venv"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# demo-quipuswap
# demo-big-maps

My shiny new indexer based on DipDup

## First steps

* Install Poetry and GNU Make
* Enter the project's directory with `cd demo-quipuswap`
* Enter the project's directory with `cd demo-big-maps`
* Install required dependencies with `make install`
* Generate types and handlers with `dipdup init`
* Ensure generated project is valid with `make lint`
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
spec_version: 1.2
package: demo_domains_big_map
package: demo_big_maps

database:
kind: sqlite
path: demo-domains-big-map.sqlite3
path: demo-big-maps.sqlite3

contracts:
mainnet_name_registry:
Expand All @@ -16,7 +16,7 @@ datasources:
url: ${TZKT_URL:-https://api.tzkt.io}

templates:
domains_big_map:
big_maps:
kind: big_map
datasource: <datasource>
skip_history: once
Expand All @@ -29,8 +29,8 @@ templates:
path: store.expiry_map

indexes:
domains_big_map_mainnet:
template: domains_big_map
big_maps_mainnet:
template: big_maps
values:
datasource: tzkt_mainnet
name_registry: mainnet_name_registry
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.poetry]
name = "demo-quipuswap"
name = "demo-big-maps"
version = "0.0.1"
description = "My shiny new indexer based on DipDup"
license = "MIT"
Expand All @@ -8,7 +8,7 @@ authors = [
]
readme = "README.md"
packages = [
{ include = "demo_quipuswap", from = "src" },
{ include = "demo_big_maps", from = "src" },
]

[tool.poetry.dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"license": "MIT",
"line_length": "120",
"linters": "default",
"package": "demo_quipuswap",
"package": "demo_big_maps",
"postgresql_image": "postgres:14",
"project_name": "demo-quipuswap",
"template": "demo_quipuswap",
"project_name": "demo-big-maps",
"template": "demo_big_maps",
"version": "0.0.1"
}
1 change: 1 addition & 0 deletions demos/demo-big-maps/src/demo_big_maps/demo_big_maps
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import demo_domains_big_map.models as models
from demo_domains_big_map.types.name_registry.big_map.store_expiry_map_key import StoreExpiryMapKey
from demo_domains_big_map.types.name_registry.big_map.store_expiry_map_value import StoreExpiryMapValue
import demo_big_maps.models as models
from demo_big_maps.types.name_registry.big_map.store_expiry_map_key import StoreExpiryMapKey
from demo_big_maps.types.name_registry.big_map.store_expiry_map_value import StoreExpiryMapValue
from dipdup.context import HandlerContext
from dipdup.models import BigMapDiff

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import demo_domains_big_map.models as models
from demo_domains_big_map.types.name_registry.big_map.store_records_key import StoreRecordsKey
from demo_domains_big_map.types.name_registry.big_map.store_records_value import StoreRecordsValue
import demo_big_maps.models as models
from demo_big_maps.types.name_registry.big_map.store_records_key import StoreRecordsKey
from demo_big_maps.types.name_registry.big_map.store_records_value import StoreRecordsValue
from dipdup.context import HandlerContext
from dipdup.models import BigMapDiff

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from unittest import IsolatedAsyncioTestCase

import demo_quipuswap
import demo_big_maps


class ExampleTest(IsolatedAsyncioTestCase):
async def test_example(self):
assert demo_quipuswap
assert demo_big_maps
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion demos/demo-tzbtc/Makefile → demos/demo-dao/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ build: ## Build Python wheel package
poetry build

image: ## Build Docker image
docker buildx build . -t demo-tzbtc:${TAG}
docker buildx build . -t demo-dao:${TAG}

clean: ## Remove all files from .gitignore except for `.venv`
git clean -xdf --exclude=".venv"
Expand Down
4 changes: 2 additions & 2 deletions demos/demo-tzbtc/README.md → demos/demo-dao/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# demo-tzbtc
# demo-dao

My shiny new indexer based on DipDup

## First steps

* Install Poetry and GNU Make
* Enter the project's directory with `cd demo-tzbtc`
* Enter the project's directory with `cd demo-dao`
* Install required dependencies with `make install`
* Generate types and handlers with `dipdup init`
* Ensure generated project is valid with `make lint`
Expand Down
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions demos/demo-dao/dipdup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
spec_version: 1.2
package: demo_dao

database:
kind: sqlite
path: demo-dao.sqlite3

contracts:
registry:
code_hash: KT19CF3KKrvdW77ttFomCuin2k4uAVkryYqh
typename: registry

datasources:
tzkt:
kind: tzkt
url: ${TZKT_URL:-https://api.tzkt.io}

indexes:
registry_dao:
kind: operation
datasource: tzkt
types:
- transaction
- origination
handlers:
- callback: on_origination
pattern:
- type: origination
originated_contract: registry
- callback: on_propose
pattern:
- type: transaction
destination: registry
entrypoint: propose
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.poetry]
name = "demo-tzbtc"
name = "demo-dao"
version = "0.0.1"
description = "My shiny new indexer based on DipDup"
license = "MIT"
Expand All @@ -8,7 +8,7 @@ authors = [
]
readme = "README.md"
packages = [
{ include = "demo_tzbtc", from = "src" },
{ include = "demo_dao", from = "src" },
]

[tool.poetry.dependencies]
Expand Down
Loading

0 comments on commit 0f3de55

Please sign in to comment.