Skip to content
Open
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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgres://torii:torii@localhost:5432/torii
130 changes: 124 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ clap = { version = "4.5", features = ["derive"] }

# ETL Pipeline dependencies
starknet = "0.17"
sqlx = { version = "0.8", features = ["runtime-tokio", "sqlite"] }
sqlx = { version = "0.8", features = ["runtime-tokio", "sqlite", "postgres", "any"] }
async-trait = "0.1"
anyhow = "1.0"
chrono = "0.4"
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ This work is still in progress, refer to the modules documentation for more deta

## 🚀 Quick Start

### Start PostgreSQL (Docker Compose)

```bash
docker compose up -d postgres
```

Default connection string:

```bash
export DATABASE_URL=postgres://torii:torii@localhost:5432/torii
```

### Running Examples

```bash
Expand Down
3 changes: 3 additions & 0 deletions bins/torii-erc20/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,14 @@ torii-erc20 \
--from-block <START> \
--to-block <END> \
--db-path ./my-data.db \
--database-url postgres://torii:torii@localhost:5432/torii \
--port 3000 \
--no-auto-discovery \
--contracts <ADDR1>,<ADDR2>
```

`--database-url` (or `DATABASE_URL`) enables PostgreSQL-backed storage for both engine state and ERC20 data. If unset, local SQLite files are used.

## Architecture

```
Expand Down
7 changes: 7 additions & 0 deletions bins/torii-erc20/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ pub struct Config {
#[arg(long, default_value = "./erc20-data.db")]
pub db_path: String,

/// Optional engine database URL/path.
///
/// Supports PostgreSQL (`postgres://...`) and SQLite (`sqlite:...` or file path).
/// When omitted, engine state uses `<db-path parent>/engine.db`.
#[arg(long, env = "DATABASE_URL")]
pub database_url: Option<String>,

/// Disable auto-discovery of ERC20 contracts
///
/// When enabled, only explicitly configured contracts will be indexed.
Expand Down
Loading
Loading