diff --git a/.example.env b/.example.env new file mode 100644 index 0000000..44ce2a6 --- /dev/null +++ b/.example.env @@ -0,0 +1,6 @@ +# Treasury instance within treasury metadata transactions +# this is used to filter out metadata and transactions which are not relevant + +# 9e65e4ed7d6fd86fc4827d2b45da6d2c601fb920e8bfd794b8ecc619 = Intersect 2025 budget instance + +TREASURY_INSTANCE= diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/README.md b/README.md index c02e4af..954a0b4 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ API instance hosted at ``` administration-data/ +├── .env # Environment variables (not committed) ├── indexer/ # YACI Store indexer configuration │ ├── application.properties │ ├── config/ @@ -162,7 +163,14 @@ The YACI Store indexer exposes its own API on port 8081: ### Treasury Reserve Contract -We can configure the Treasury Reserve instance that we index for. +We can configure the Treasury Reserve instance that we index for via the `.env` file at the project root: + +```bash +# .env +TREASURY_INSTANCE=9e65e4ed7d6fd86fc4827d2b45da6d2c601fb920e8bfd794b8ecc619 +``` + +This environment variable is passed to the indexer container via `docker-compose.yml` and used by the `treasury-filter.mvel` plugin script to filter metadata. | Property | Value | |----------|-------| @@ -252,7 +260,7 @@ ORDER BY block_time DESC LIMIT 10; YACI Store plugins filter blockchain data to only store treasury-relevant information: -- **Metadata Filter**: Only metadata with label `1694` (TOM standard) AND instance `9e65e4ed7d6fd86fc4827d2b45da6d2c601fb920e8bfd794b8ecc619` +- **Metadata Filter**: Only metadata with label `1694` (TOM standard) AND the treasury instance configured via `TREASURY_INSTANCE` in `.env` This reduces database size by ~95% while keeping all treasury data. diff --git a/docker-compose.yml b/docker-compose.yml index e6d9356..028b4a0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,8 @@ services: depends_on: postgres: condition: service_healthy + env_file: + - .env environment: - JAVA_OPTS=-Xmx2g -Xms1g ports: diff --git a/docs/architecture.md b/docs/architecture.md index 21aa377..184b625 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -162,8 +162,8 @@ This document describes how data flows through the Cardano Administration Data S │ │ ▼ ▼ ┌─────────────────────────────────────┐ - │ instance == "9e65e4ed..." ? │ - │ (Treasury instance ID) │ + │ instance == TREASURY_INSTANCE ? │ + │ (from env variable) │ └─────────────────────────────────────┘ │ │ YES NO diff --git a/indexer/SETUP.md b/indexer/SETUP.md index 686c148..84b78ee 100644 --- a/indexer/SETUP.md +++ b/indexer/SETUP.md @@ -22,6 +22,18 @@ Note: The script may fail if the release tag format is different. In that case, ## Configuration +### Environment Variables + +Create a `.env` file in the project root with the treasury instance to filter for: + +```bash +TREASURY_INSTANCE=9e65e4ed7d6fd86fc4827d2b45da6d2c601fb920e8bfd794b8ecc619 +``` + +This is used by the `treasury-filter.mvel` plugin script to filter metadata by instance. + +### Application Properties + Edit `application.properties` to configure: - Database connection details - Cardano network settings diff --git a/indexer/plugins/scripts/treasury-filter.mvel b/indexer/plugins/scripts/treasury-filter.mvel index 2bc09d2..9ee4ea8 100644 --- a/indexer/plugins/scripts/treasury-filter.mvel +++ b/indexer/plugins/scripts/treasury-filter.mvel @@ -1,5 +1,5 @@ // Treasury instance identifier - only track metadata for this specific instance -TREASURY_INSTANCE = "9e65e4ed7d6fd86fc4827d2b45da6d2c601fb920e8bfd794b8ecc619"; +TREASURY_INSTANCE = System.getenv("TREASURY_INSTANCE"); // Filter metadata - only keep label 1694 with matching treasury instance def filterMetadata(items) {